Scarab  v2.4.11
Project 8 C++ Utility Library
typename.hh
Go to the documentation of this file.
1 /*
2  * typename.hh
3  *
4  * Created on: Feb 10, 2016
5  * Author: nsoblath
6  *
7  * Based on: http://stackoverflow.com/a/4541470
8  */
9 
10 #ifndef SCARAB_UTILITY_TYPENAME_HH_
11 #define SCARAB_UTILITY_TYPENAME_HH_
12 
13 #include "scarab_api.hh"
14 
15 #include <string>
16 #include <typeinfo>
17 
18 namespace scarab
19 {
20 
21  SCARAB_API std::string demangle( const char* a_name );
22 
23  template <class x_type>
24  SCARAB_API std::string type( const x_type& a_param )
25  {
26  return demangle( typeid(a_param).name() );
27  }
28 
29 } /* namespace scarab */
30 
31 
32 #endif /* SCARAB_UTILITY_TYPENAME_HH_ */
#define SCARAB_API
Definition: scarab_api.hh:24
std::string type(const x_type &a_param)
Definition: typename.hh:24
std::string demangle(const char *a_name)
Definition: typename.cc:60