Is it safe to use 'is' to compare types?
Yuxuan Shui via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Thu Mar 3 15:58:39 PST 2016
On Thursday, 3 March 2016 at 23:51:16 UTC, Adam D. Ruppe wrote:
> On Thursday, 3 March 2016 at 23:46:50 UTC, Yuxuan Shui wrote:
>> Will typeid(a) is typeid(b) yield different results than
>> typeid(a) == typeid(b)?
>
> No. Indeed, opEquals on TypeInfo just calls is itself.
But opEquals also has extra comparison:
auto ti = cast(const TypeInfo)o;
return ti && this.toString() == ti.toString();
This makes me feel they are not the same.
More information about the Digitalmars-d-learn
mailing list