Scarab
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 <string>
14 #include <typeinfo>
15 
16 namespace scarab
17 {
18 
19  std::string demangle( const char* a_name );
20 
21  template <class x_type>
22  std::string type( const x_type& a_param )
23  {
24  return demangle( typeid(a_param).name() );
25  }
26 
27 } /* namespace scarab */
28 
29 
30 #endif /* SCARAB_UTILITY_TYPENAME_HH_ */
std::string type(const x_type &a_param)
Definition: typename.hh:22
std::string demangle(const char *a_name)
Definition: typename.cc:58