What's the correct opEquals signature for structs?
bearophile
bearophileHUGS at lycos.com
Tue Mar 13 15:35:59 PDT 2012
Alex R. Petersen:
> It was an integer in the past (believe it or not). :) equals_t made the
> transition easier.
Thank you for your answers, now I understand.
Using an int makes sense for opEquals, because if opEquals doesn't get inlined then using int is sometimes able to give you a bit more efficiency (there is no need to convert values different from 0 and 1 to 1). I don't know how much this saves you on modern CPUs (probably no more than few CPU cycles).
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list