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

free function to pretty-print the class name of an object. Moved here from fvectortest.cc

[[Imported from SVN: r6239]]
parent cbaf1a71
Branches
Tags
No related merge requests found
......@@ -22,6 +22,7 @@ commoninclude_HEADERS = \
bigunsignedint.hh \
binaryfunctions.hh \
bitsetvector.hh \
classname.hh \
collectivecommunication.hh \
configparser.hh \
debugstream.hh \
......
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
#ifndef DUNE_CLASSNAME_HH
#define DUNE_CLASSNAME_HH
/** \file
* \brief A free function to provide the demangled class name
* of a given object as a string
*/
#ifdef __GNUC__
#include <cxxabi.h>
#endif
namespace Dune {
/** \brief Provide the demangled class name of a given object as a string */
template <class T>
std::string className(T &t)
{
#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.
Please register or to comment