fork(1) download
  1.  
  2. import std.stdio;
  3. import std.container;
  4.  
  5. class TestClass {
  6. this(int v_) {
  7. v = v_;
  8. }
  9. int v;
  10. }
  11.  
  12. void main() {
  13.  
  14. auto rb = redBlackTree!(TestClass *)();
  15. TestClass c1 = new TestClass(1);
  16. TestClass c2 = new TestClass(2);
  17.  
  18. rb.insert(c1);
  19. rb.insert(c2);
  20.  
  21. foreach (TestClass *t; rb)
  22. writeln(t.v);
  23. }
Compilation error #stdin compilation error #stdout 0s 3772KB
stdin
Standard input is empty
compilation info
prog.d:18: error: template std.container.RedBlackTree!(TestClass*).RedBlackTree.stableInsert cannot deduce function from argument types !()(TestClass), candidates are:
/usr/include/d/4.9/std/container.d:5955: note: std.container.RedBlackTree!(TestClass*).RedBlackTree.stableInsert(Stuff)(Stuff stuff) if (isImplicitlyConvertible!(Stuff, Elem))
/usr/include/d/4.9/std/container.d:5974: note: std.container.RedBlackTree!(TestClass*).RedBlackTree.stableInsert(Stuff)(Stuff stuff) if (isInputRange!Stuff && isImplicitlyConvertible!(ElementType!Stuff, Elem))
prog.d:19: error: template std.container.RedBlackTree!(TestClass*).RedBlackTree.stableInsert cannot deduce function from argument types !()(TestClass), candidates are:
/usr/include/d/4.9/std/container.d:5955: note: std.container.RedBlackTree!(TestClass*).RedBlackTree.stableInsert(Stuff)(Stuff stuff) if (isImplicitlyConvertible!(Stuff, Elem))
/usr/include/d/4.9/std/container.d:5974: note: std.container.RedBlackTree!(TestClass*).RedBlackTree.stableInsert(Stuff)(Stuff stuff) if (isInputRange!Stuff && isImplicitlyConvertible!(ElementType!Stuff, Elem))
stdout
Standard output is empty