guanaqo 1.0.0-alpha.24
Utilities for scientific software
Loading...
Searching...
No Matches
demangled-typename.cpp
Go to the documentation of this file.
2
3#include <cstdlib>
4#include <memory>
5#ifdef __GNUC__
6#include <cxxabi.h>
7#endif
8
9namespace guanaqo {
10
11std::string demangled_typename(const std::type_info &t) {
12#ifdef __GNUC__
13 return std::unique_ptr<char, decltype(&std::free)>{
14 abi::__cxa_demangle(t.name(), nullptr, nullptr, nullptr), std::free}
15 .get();
16#else
17 return t.name();
18#endif
19}
20
21} // namespace guanaqo
Pretty-print type names.
std::string demangled_typename(const std::type_info &t)
Get the pretty name of the given type as a string.