forked from boostorg/core
Add support for incomplete classes to type_name<>. Refs #145.
This commit is contained in:
@ -102,11 +102,23 @@ inline std::string fix_typeid_name( char const* n )
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T> std::string typeid_name()
|
// class types can be incomplete
|
||||||
|
template<class T> std::string typeid_name_impl( int T::* )
|
||||||
|
{
|
||||||
|
std::string r = fix_typeid_name( typeid(T[1]).name() );
|
||||||
|
return r.substr( 0, r.size() - 4 ); // remove ' [1]' suffix
|
||||||
|
}
|
||||||
|
|
||||||
|
template<class T> std::string typeid_name_impl( ... )
|
||||||
{
|
{
|
||||||
return fix_typeid_name( typeid(T).name() );
|
return fix_typeid_name( typeid(T).name() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class T> std::string typeid_name()
|
||||||
|
{
|
||||||
|
return typeid_name_impl<T>( 0 );
|
||||||
|
}
|
||||||
|
|
||||||
// template names
|
// template names
|
||||||
|
|
||||||
template<class T> std::string class_template_name()
|
template<class T> std::string class_template_name()
|
||||||
|
Reference in New Issue
Block a user