The OpenD Programming Language

hasMember

Yields true if and only if T is an aggregate that defines a symbol called name.

See also: __traits(hasMember, T, name)

enum hasMember (
T
string name
)

Examples

static assert(!hasMember!(int, "blah"));
struct S1 { int blah; }
struct S2 { int blah(){ return 0; } }
class C1 { int blah; }
class C2 { int blah(){ return 0; } }
static assert(hasMember!(S1, "blah"));
static assert(hasMember!(S2, "blah"));
static assert(hasMember!(C1, "blah"));
static assert(hasMember!(C2, "blah"));

Meta