opCmp and opEquals woes
Daniel Murphy via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jul 25 03:11:12 PDT 2014
"Jonathan M Davis" wrote in message
news:lzigfacgrlssjuemoqyg at forum.dlang.org...
> The compiler _never_ defines opCmp for you. You have to do that yourself.
> So, what you're suggesting would force people to define opEquals just
> because they defined opCmp unless they wanted to take a performance hit
> <<<<<<<< in the rare case that it actually matters >>>>>>>>>>.
> And once you define opEquals, you have to define toHash. So, what you're
> suggesting would force a lot more code to define toHash, which will likely
> cause far more bugs than simply requiring that the programmer define
> opEquals if that's required in order to make it consistent with opEquals.
More information about the Digitalmars-d
mailing list