Standard library header <typeindex> (C++11)
From cppreference.net
C++
Standard library headers
此头文件是 类型支持 库的组成部分。
包含文件 |
||
|
(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; // 仅用于说明 // 注意此处使用指针而非引用, // 意味着将提供默认的复制/移动构造函数和赋值操作符, // 并能按预期工作。 }; }