1 | #ifndef UTIL_HH |
---|---|
2 | #define UTIL_HH |
3 | #include <sstream> |
4 | #include <string> |
5 | #include <typeinfo> |
6 | |
7 | using namespace std; |
8 | |
9 | /* TODO: The strings are implementation-defined. How do they look in |
10 | clang? */ |
11 | |
12 | inline std::string pretty_type(const char *raw) { |
13 | ostringstream os; |
14 | os << raw; |
15 | string s = os.str(); |
16 | while (s[0] <= '9') |
17 | s.erase(s.begin()); |
18 | return s; |
19 | } |
20 | |
21 | inline std::string pretty_type(struct prod *p) { |
22 | return pretty_type(typeid(*p).name()); |
23 | } |
24 | |
25 | #endif |
26 |