WAT: opCmp and opEquals woes
Jacob Carlborg via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jul 25 04:19:53 PDT 2014
On 25/07/14 12:07, Jonathan M Davis wrote:
> 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. 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.
Again, you're assuming there will be a performance hit.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list