Misunderstanding, silly error, or compiler bug?
Daniel919
Daniel919 at web.de
Fri Aug 10 06:30:18 PDT 2007
Hi, welcome to D ;)
Line 45 in tree.d:
while( current != null ) {
If you use the == operator on objects, the opEqual method
of the class will be called.
Now if your object was not instantiated, this will fail of course.
Instead of this, you have to check whether the reference is null:
while( current !is null ) {
Another hint:
Tree!(int) my_tree = new Tree!(int);
don't know whether you know it, but you could use:
auto my_tree = new Tree!(int);
D supports type inference by using the keyword auto.
Best regards,
Daniel
More information about the Digitalmars-d-learn
mailing list