WAT: opCmp and opEquals woes

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 25 01:28:53 PDT 2014


On 25/07/14 08:31, Jonathan M Davis wrote:

> Exactly. The only reason that switching from using lhs.opCmp(rhs) == 0
> to opEquals would break code is if a type does not define them such that
> they're equivalent, which would mean that opEquals and/or opCmp was
> defined in a buggy manner. So, the only way that the change would break
> code is if it was broken in the first place. All it risks is making it
> so that the bug exhibits itself in an additional case.

If the type is only used as an AA key and never checked for equivalent 
it worked when opCmp as used for AA keys.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list