opCmp and opEquals woes

Daniel Murphy via Digitalmars-d digitalmars-d at puremagic.com
Wed Jul 23 23:20:01 PDT 2014


"Jonathan M Davis"  wrote in message 
news:kquxovegjzzsivftxsud at forum.dlang.org...

> The best option though would be to provide some way for the programmer to 
> tell the compiler that they want to use the default one so that they still 
> have to declare opEquals when they define opCmp (to make sure that the 
> programmer didn't forget it), but they're still able to use the built-in 
> one rather than writing it themselves. IIRC, C++11 has a way of doing 
> that. Maybe we should add something similar.

bool opEquals(const ref other) const { return this.tupleof == 
other.tupleof; } 



More information about the Digitalmars-d mailing list