Print the Name of a Type
printf("Type Name: %s", reflect<T>().name.c_str());
Explaination
reflect<T>()
returns a type_descriptor<T>
(an empty TrivialType
describing T
)
type_descriptor<T>::name
returns const_string<N>
(name
is a static member)
const_string<N>::c_str()
returns const char*
Print the Members of a Type
type_descriptor<T> td;
printf("Member Name: %s\n" member.name.c_str());
});
Explaination
type_descriptor<T>
is a TrivialType
which describes T
. Can be also created with reflect<T>()
;
type_descriptor<T>::members
returns type_list<Ts...>
(members
is a static member of type type_list<Ts...>
where each Ts... is either field_descriptor<T, I>
or function_descriptor<T, I>
)
member_descriptor_base<T, I>::name
returns const_string<N>
(name
is a static member)
const_string<N>::c_str()
returns const char*