Ordering comparisons

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Tue Mar 7 04:30:49 PST 2017


On Tuesday, 7 March 2017 at 01:27:56 UTC, Andrei Alexandrescu 
wrote:
> The question is what to do to minimize breakage yet "break the 
> bad code". The most backward-compatible solution is to define 
> opCmp automatically to do a field-by-field lexicographical 
> comparison. The most radical solution is disable ordering 
> comparisons unless explicitly implemented by the user.
>

There should be no assumption that structs are comparable, so the 
later.



More information about the Digitalmars-d mailing list