WAT: opCmp and opEquals woes

via Digitalmars-d digitalmars-d at puremagic.com
Sat Jul 26 05:19:40 PDT 2014


On Saturday, 26 July 2014 at 10:43:08 UTC, Ola Fosheim Grøstad 
wrote:
> On Saturday, 26 July 2014 at 09:48:55 UTC, Andrei Alexandrescu 
> wrote:
>> On 7/26/14, 2:19 AM, "Marc Schütz" <schuetzm at gmx.net>" wrote:
>>> Yes, that's why it's possible to provide opEquals in addition 
>>> to opCmp.
>
> Not quite, opCmp would then have to throw if opCmp(a,b) is 
> incomparable. Conflating incomparable and equal values as 0 is 
> a bad idea when sorting. That means incomparable values are 
> sprinkled randomly over the sort.

Ok, I see what you mean, and I agree. If you can have 
incomparable elements, you cannot sort reliably.

But you were responding to Manu:

> But I equally can't abide == meaning something different than 
> <, <=, etc.
> That's insane.

I somehow took your response as disagreement with him.


More information about the Digitalmars-d mailing list