Whats the best way to get a struct/class member type?

simendsjo simendsjo at gmail.com
Sat Mar 31 06:20:42 PDT 2012


Seems __traits doesn't have a __traits(getMemberType, T, name).
Now I'm doing the following:
T t; // instance to use in getMember
alias typeof( __traits(getMember, t, name) ) MemberType;

Is this the only way to get the type of a field based on the name?


More information about the Digitalmars-d-learn mailing list