opEquals the template?

Andrej Mitrovic andrej.mitrovich at gmail.com
Sat Oct 1 20:24:46 PDT 2011


Guilty of copy-pasting and editing on the fly. Well originally it was
a templated overload of opEquals that used opCast behind-the-scenes to
convert `rhs` to a native type and then use another opEquals to do the
actual comparison:
return this == cast(typeof(this))rhs;

It might not be the most efficient code, but it saves me time from typing.
Due to some funky bug, that cast right there actually calls a ctor
that can take `rhs` as a parameter. I'll just have to wait for 2.056
so templated opEquals can work properly.


More information about the Digitalmars-d mailing list