static assert( isSameType!(long, long)); static assert(!isSameType!(long, const long)); static assert(!isSameType!(long, string)); static assert( isSameType!(string, string)); int i; real r; static assert( isSameType!(int, typeof(i))); static assert(!isSameType!(int, typeof(r))); static assert(!isSameType!(real, typeof(i))); static assert( isSameType!(real, typeof(r))); // Partial instantiation allows it to be used with templates that expect // a predicate that takes only a single argument. import phobos.sys.meta : AliasSeq, indexOf; alias Types = AliasSeq!(float, string, int, double); static assert(indexOf!(isSameType!int, Types) == 2);
Whether the given types are the same type.
All this does is is(T == U), so most code shouldn't use it. It's intended to be used in conjunction with templates that take a template predicate - such as those in phobos.sys.meta.
The single-argument overload makes it so that it can be partially instantiated with the first argument, which will often be necessary with template predicates.