class A { int aField; string b; bool c; class B {} struct C {} union D {} interface E {} } static assert(is(getMemberType!(A, "aField") == int)); static assert(is(getMemberType!(A, "b") == string)); static assert(is(getMemberType!(A, "c") == bool)); static assert(!is(getMemberType!(A, "B"))); static assert(!is(getMemberType!(A, "C"))); static assert(!is(getMemberType!(A, "D"))); static assert(!is(getMemberType!(A, "E")));
Retrieves member type with name of class Class. If member is agregate type declaration or simply doesn't exist, retrieves no type. You can check it with is operator.