Skip to content
Snippets Groups Projects
Commit 7efeddba authored by Oliver Sander's avatar Oliver Sander
Browse files

pretty-print the class name of a type without given object

[[Imported from SVN: r6241]]
parent 55140355
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,7 @@
/** \file
* \brief A free function to provide the demangled class name
* of a given object as a string
* of a given object or type as a string
*/
#ifdef __GNUC__
......@@ -26,5 +26,17 @@ namespace Dune {
#endif
};
/** \brief Provide the demangled class name of a type T as a string */
template <class T>
std::string className()
{
#ifdef __GNUC__
int status;
return abi::__cxa_demangle(typeid(T).name(),0,0,&status);
#else
return typeid(T).name();
#endif
};
}
#endif // DUNE_CLASSNAME_HH
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment