classname.hh

Go to the documentation of this file.
00001 #ifndef DUNE_CLASSNAME_HH
00002 #define DUNE_CLASSNAME_HH
00003 
00009 #include <string>
00010 #include <typeinfo>
00011 
00012 #ifdef __GNUC__
00013 #include <cxxabi.h>
00014 #endif
00015 
00016 namespace Dune {
00017  
00019     template <class T>
00020     std::string className(T &t)
00021     {
00022 #ifdef __GNUC__
00023         int status;
00024         return abi::__cxa_demangle(typeid(t).name(),0,0,&status);
00025 #else
00026         return typeid(t).name();
00027 #endif
00028     };
00029 
00031     template <class T>
00032     std::string className()
00033     {
00034 #ifdef __GNUC__
00035         int status;
00036         return abi::__cxa_demangle(typeid(T).name(),0,0,&status);
00037 #else
00038         return typeid(T).name();
00039 #endif
00040     };
00041     
00042 }
00043 #endif  // DUNE_CLASSNAME_HH

Generated on Fri Apr 29 2011 with Doxygen (ver 1.7.1) [doxygen-log,error-log].