WAT: opCmp and opEquals woes

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Fri Jul 25 04:18:50 PDT 2014


On 25/07/14 11:46, Jonathan M Davis wrote:

> Code that worked perfectly fine before is now slower, because it's using
> opCmp for opEquals when it wasn't before.

Who says opCmp need to be slower than opEquals.

> Even worse, if you define
> opEquals, you're then forced to define toHash, which is much harder to
> get right.

That might be a problem. But you can always call the one in TypeInfo.

> So, in order to avoid a performance hit on opEquals from
> defining opCmp

Assuming there is a performance hit.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list