NOTE: This question was originally asked way back in 2012. Before the decltype specifier was fully implemented by any major compilers. You shou
decltype
template M get_member_type(M T:: *); #define GET_TYPE_OF(mem) decltype(get_member_type(mem))
Is the C++11 way. It requires you to use &Person::age instead of Person::age, although you could easily adjust the macro to make the ampersand implicit.
&Person::age
Person::age