C++ 符号还原(Demangling),windows/linux平台需分别处理。

 

#include <typeinfo>
#include <cxxabi.h>

class Foo{};

#ifndef __GNUC__ // vc
const char *real_name = typeid(Foo*[10]).name();
#else // linux
char *real_name = abi::__cxa_demangle(typeid(Foo*[10]).name(), NULL, NULL, NULL);
#endif