On 4/6/15, Jonathan via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote: > What's the best way to do this? I'm assuming this should be best > practice: > http://dlang.org/traits.html#isSame > > struct S { } > writeln(__traits(isSame, S, S)); >
I'm not even sure when or why this trait was introduced, but you could use a simple is() expression for this, e.g.: static if (is(T == S)) { ... }