Ordering comparisons

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Tue Mar 7 11:40:53 PST 2017

On 03/07/2017 12:54 PM, H. S. Teoh via Digitalmars-d wrote:
> (1) I may be remembering wrong, but I thought structs had always been
> intended to be compared field-wise?  I remember when working on AA's
> that the compiler would emit a default implementation of opEquals that
> did member-wise comparisons. I had always assumed that something
> similar was done with inequalities... or was that just unfounded
> extrapolation?

We currently do memcmp.

Equality by memberwise comparison is almost always meaningful; ordering 
by lexicographic comparison of members is not.


More information about the Digitalmars-d mailing list