標準庫標頭檔案 <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. }; }