| 38 | namespace { |
| 39 | |
| 40 | std::string demangle_typeid(const char* name) { |
| 41 | int status = -4; // some arbitrary value to eliminate the compiler warning |
| 42 | |
| 43 | // enable c++11 by passing the flag -std=c++11 to g++ |
| 44 | std::unique_ptr<char, void (*)(void*)> res{ |
| 45 | abi::__cxa_demangle(name, nullptr, nullptr, &status), std::free}; |
| 46 | |
| 47 | return (status == 0) ? res.get() : name; |
| 48 | } |
| 49 | } // namespace |
| 50 | #else |
| 51 |