Type.h
Go to the documentation of this file.
1 #ifndef WIRECELL_TYPE
2 #define WIRECELL_TYPE
3 
4 // Some type utilities
5 
6 #include <string>
7 #include <typeinfo>
8 
9 namespace WireCell {
10 
11  // Warning! do not rely on the actual format of demangle() and
12  // type() to be consistent across compilers! It's only for adding
13  // pretty-printing niceties for those that happen to be supported.
14 
15  // http://stackoverflow.com/a/4541470
16 
18 
19  template <class T>
20  std::string type(const T& t) {
21  return demangle(typeid(t).name());
22  }
23 
24 
25 }
26 
27 
28 #endif
static QCString name
Definition: declinfo.cpp:673
std::string string
Definition: nybbler.cc:12
std::string demangle(const std::string &name)
Definition: Type.cxx:6
Definition: Main.h:22
std::string type(const T &t)
Definition: Type.h:20