name() << '\n'; std::string real_name = boost::core::demangle(typeid(pb).name()); std::cout << typeid(pb).name() << " => " << real_name << '\n'; std::cout << "c++filt => " << std::flush; std::string s = typeid(pb).name(); std::system(("c++filt -t " ...
#ifndef TYPE_HPP #define TYPE_HPP #include <string> #include <typeinfo> std::string demangle(const char* name); template <class T> std::string type(const T& t) { return demangle(typeid(t).name()); } #endif 在文件 type.cpp 中(需要 C++11) #include "type.hpp" #ifdef __GNUG_...
解开std :: type_info :: name的结果 我目前正在研究一些日志代码,它们应该 - 除其他外 - 打印有关调用函数的信息。这应该相对容易,标准C ++有一个type_info类。它包含typeid'd类/函数/ etc的名称。但它被破坏了。它不是很有用。即typeid(std::vector<int>).name()回归St6vectorIiSaIiEE。 有没有办法...
std::allocator_arg std::allocator_arg_t std::any std::any::any std::any::emplace std::any::has_value std::any::reset std::any::swap std::any::type std::any_cast std::apply std::asctime std::as_const std::atexit std::atomic_...<std::shared_ptr> std::at_quick_exit std:...
std::type_info::name constchar*name()const; (noexcept since C++11) Returns an implementation defined null-terminated character string containing the name of the type. No guarantees are given; in particular, the returned string can be identical for several types and change between invocations of ...