功能特性测试宏值标准功能特性 __cpp_lib_constexpr_typeinfo 202106L (C++23) std::type_info::operator== 的constexpr 示例运行此代码 #include <iostream> #include <string> #include <typeinfo> #include <utility> class person { public: explicit person(std::string n) : name_(std::move(n)...
type_info 类既不满足可复制构造 (CopyConstructible) 也不满足可复制赋值 (CopyAssignable) 。 成员函数 (构造函数) [弃置] 无默认或复制构造函数 (公开成员函数) (析构函数) [虚] 虚析构函数使 type_info 为多态类 (虚公开成员函数) operator= [弃置] 不能复制赋值 (公开成员函数) operato...
warning: failed to compute relocation: IMAGE_REL_I386_REL32, Invalid data was encountered while parsing the file lld-link: error: duplicate symbol: std::type_info::operator==(std::type_info const&) const >>> defined at C:/tools/msys64/mingw32/include/c++/10.3.0/typeinfo:121 >>> obje...
std::type_info::hash_code std::type_info::name std::type_info::operator!= std::type_info::operators std::unary_function std::unary_negate std::uncaught_exception std::uncaught_exceptions std::undeclare_no_pointers std::undeclare_reachable std::underflow_error std::underlying_type std::unex...
std::type_info::hash_code std::type_info::name std::type_info::operator!= std::type_info::operators std::unary_function std::unary_negate std::uncaught_exception std::uncaught_exceptions std::undeclare_no_pointers std::undeclare_reachable std::underflow_error std::underlying_type std::unex...
type_info 本身的比较就考虑到存在多份对象的可能—— operator== 在知道有两个不同 type_info 对象...
std::type_info类可以在执行期间查询对象型别,但使用起来比较麻烦。为此定义了wrapper下面的代码出自 Loki库:总得来说是提供了std::type_info的所有成员函数;提供了value语义,即public copy构造函数和public assignment操作符;定义了 operator< 和 operator== 等...
= '*' && [Current thread is 1 (Thread 0x7fe8ecaef700 (LWP 5994))] (gdb) bt #0 0x00005598515613c7 in std::type_info::operator== (this=0x7fe8f20aa950 <std::_Sp_make_shared_tag::_S_ti()::__tag>, __arg=...) at /usr/include/c++/8.2.1/typeinfo:123 #1 0x0000559851567235...
virtual ~type_info(); Destructs an object of type std::type_info. This destructor is public virtual, making the std::type_info a polymorphic class. NotesThe dynamic type of a std::type_info subobject may be examined by the typeid operator. ...
Possible output: char goes before int in this implementation. See also operator==operator!= (removed in C++20) checks whether the objects refer to the same type (public member function)