this compare not using opCmp?
Jonathan M Davis
jmdavisProg at gmx.com
Sun Apr 29 23:00:07 PDT 2012
On Monday, April 30, 2012 07:28:16 Era Scarecrow wrote:
> On Monday, 30 April 2012 at 05:22:56 UTC, Jonathan M Davis wrote:
> > == uses opEquals, not opCmp. It's using Object's opEquals,
> > which does a
> > comparison of the references, so it's true when comparing the
> > exact same
> > object and false otherwise.
>
> Ahhh of course. Personally I think opCmp includes opEquals... At
> least I only have to deal with 2 compare functions and not more.
I believe that there are two major reasons why opEquals is separate:
1. Many types of objects can have equality but less than and greater than
comparisons would make no sense for them.
2. It's more efficient to check for equality with opEquals than it would be with
opCmp.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list