hasStaticMember

Whether the symbol represented by the string, member, exists and is a static member of T.

template hasStaticMember (
T
string member
) {
enum bool hasStaticMember;
enum bool hasStaticMember;
enum bool hasStaticMember;
}

Parameters

T

Type containing symbol member.

member

Name of symbol to test that resides in T.

Return Value

true iff member exists and is static.

Examples

1 static struct S
2 {
3     static void sf() {}
4     void f() {}
5 
6     static int si;
7     int i;
8 }
9 
10 static assert( hasStaticMember!(S, "sf"));
11 static assert(!hasStaticMember!(S, "f"));
12 
13 static assert( hasStaticMember!(S, "si"));
14 static assert(!hasStaticMember!(S, "i"));
15 
16 static assert(!hasStaticMember!(S, "hello"));

Meta

Suggestion Box / Bug Report