== operator

anonymous via Digitalmars-d digitalmars-d at puremagic.com
Sun Jan 4 06:41:10 PST 2015


On Sunday, 4 January 2015 at 03:37:05 UTC, Andrei Alexandrescu 
wrote:
>> By the way, I think `typeid(a) == typeid(b)` is silly. It calls
>> object.opEquals on the `typeid`s. And if they're not 
>> identical, that in
>> turn calls object.opEquals on the `typeid`s of the `typeid`s. 
>> That
>> fortunately hits the `is` case, or we'd go on forever. All 
>> that only to
>> realize that `typeid(a).opEquals(typeid(b))` suffices.
>>
>> [1] http://dlang.org/operatoroverloading.html
>
> Interesting. Is a pull request in your future? :o) -- Andrei

No need. The actual code has it right: 
https://github.com/D-Programming-Language/druntime/blob/b3a8032e3960480a1588b3d1a4491808b4502d67/src/object_.d#L171


More information about the Digitalmars-d mailing list