isType

Detect whether X is a type. Analogous to is(X). This is useful when used in conjunction with other templates, e.g. allSatisfy!(isType, X).

enum isType ()

Return Value

true if X is a type, false otherwise

Examples

struct S {
    template Test() {}
}
class C {}
interface I {}
union U {}
static assert(isType!int);
static assert(isType!string);
static assert(isType!(int[int]));
static assert(isType!S);
static assert(isType!C);
static assert(isType!I);
static assert(isType!U);

int n;
void func(){}
static assert(!isType!n);
static assert(!isType!func);
static assert(!isType!(S.Test));
static assert(!isType!(S.Test!()));

Meta