WAT: opCmp and opEquals woes

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 25 13:38:33 PDT 2014


On 7/25/2014 4:10 AM, Regan Heath wrote:
> Sure, Andrei makes a valid point .. for a minority of cases.  The majority case
> will be that opEquals and opCmp==0 will agree.  In those minority cases where
> they are intended to disagree the user will have intentionally defined both, to
> be different.  I cannot think of any case where a user will intend for these to
> be different, then not define both to ensure it.

You've agreed with my point, then, that autogenerating opEquals as memberwise 
equality (not opCmp==0) if one is not supplied will be correct unless the user 
code is already broken.


More information about the Digitalmars-d mailing list