Type.opDispatch

Convience function that forwards to std.traits.

struct Type(T)
const pure nothrow @safe @nogc
opDispatch
(
string traitName
)
()

Examples

enum t1 = type!int;
static assert (t1.opDispatch!"isIntegral");

static assert ( type!float.isFloatingPoint);
static assert (!type!float.isBoolean);

enum t2 = type!string[type!int[]];
static assert (t2 == type!(string[int[]]));
static assert ( t2.isAssociativeArray);
static assert (!t2.isArray);

enum t3 = type!(byte*);
static assert (t3.PointerTarget == type!byte);

enum Names : string { n1 = "asd", n2 = "bfg" }
enum t4 = type!Names;
static assert (t4.OriginalType == type!string);
enum members = t4.EnumMembers;
static assert ([t4.EnumMembers.expand] == [Names.n1, Names.n2]);

class C0 {}
class C1 : C0 {}
class C2 : C1 {}
class C3 : C2 {}

enum t5 = type!C3;
static assert (t5.BaseClassesTuple ==
    aliasTuple!(Type!C2, Type!C1, Type!C0, Type!Object));

interface I0 { }
interface I1 { }
interface I2 { }
interface I12 : I0, I1, I2 { }
interface I12_12 : I1, I2, I12 {}

enum t6 = type!I12_12;
static assert (t6.InterfacesTuple ==
    aliasTuple!(Type!I1, Type!I2, Type!I12, Type!I0));

Meta