mirror of
https://github.com/boostorg/core.git
synced 2025-05-09 14:57:46 +00:00
Add support for incomplete classes to type_name<>. Refs #145.
This commit is contained in:
parent
97606908b7
commit
36fa78f53c
@ -102,11 +102,23 @@ inline std::string fix_typeid_name( char const* n )
|
||||
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() );
|
||||
}
|
||||
|
||||
template<class T> std::string typeid_name()
|
||||
{
|
||||
return typeid_name_impl<T>( 0 );
|
||||
}
|
||||
|
||||
// template names
|
||||
|
||||
template<class T> std::string class_template_name()
|
||||
|
Loading…
x
Reference in New Issue
Block a user