mirror of
https://github.com/mat007/turtle.git
synced 2026-06-22 12:13:43 +00:00
Fixed type name extraction
git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@70 860be788-9bd5-4423-9f1e-828f051e677b
This commit is contained in:
parent
d0bda73778
commit
eb78cf942e
3 changed files with 76 additions and 12 deletions
|
|
@ -43,27 +43,21 @@ namespace detail
|
|||
guard g( result );
|
||||
if( result )
|
||||
return result;
|
||||
else
|
||||
return name;
|
||||
#else
|
||||
return name;
|
||||
#endif
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
std::string type_full_name()
|
||||
{
|
||||
return type_full_name( typeid( T ) );
|
||||
return name;
|
||||
}
|
||||
|
||||
template< typename T >
|
||||
std::string type_name()
|
||||
{
|
||||
const std::string name = type_full_name< T >();
|
||||
const std::string name = type_full_name( typeid( T ) );
|
||||
std::size_t p = name.rfind( "::" );
|
||||
if( p != std::string::npos )
|
||||
return name.substr( p + 2 );
|
||||
return "";
|
||||
p = name.rfind( " " );
|
||||
if( p != std::string::npos )
|
||||
return name.substr( p + 1 );
|
||||
return name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue