标准库头文件 <typeindex> (C++11)
来自 cppreference.com
此头文件是 类型支持 库的一部分。
包含 | ||
(C++20) |
三元比较运算符 支持 | |
类 | ||
(C++11) |
围绕 type_info 对象的包装器,可作为关联容器和无序关联容器的索引使用(类) | |
(C++11) |
对 std::type_index 的哈希支持 (类模板特化) | |
前向声明 | ||
在头文件
<functional> 中定义 | ||
(C++11) |
哈希函数对象 (类模板) |
[编辑] 概述
#include <compare> namespace std { class type_index; template<class T> struct hash; template<> struct hash<type_index>; }
[编辑] 类 std::type_index
namespace std { class type_index { public: type_index(const type_info& rhs) noexcept; bool operator==(const type_index& rhs) const noexcept; bool operator< (const type_index& rhs) const noexcept; bool operator> (const type_index& rhs) const noexcept; bool operator<=(const type_index& rhs) const noexcept; bool operator>=(const type_index& rhs) const noexcept; strong_ordering operator<=>(const type_index& rhs) const noexcept; size_t hash_code() const noexcept; const char* name() const noexcept; private: const type_info* target; // exposition only // Note that the use of a pointer here, rather than a reference, // means that the default copy/move constructor and assignment // operators will be provided and work as expected. }; }