C++11

标准文档 中当前头文件是通用工具库(General utilities library)中的部分内容,为了更好的表述其内容,本手册将其移至语言支持库(Language support library)中的 类型支持 主题中。

语言支持库(参考手册) ​语言支持库(标准)

通用工具库(参考手册) ​通用工具库(标准)

  • type_index C++11 该类是 type_info 对象的封装类(Wrapper),可以被用来作为关联(Associative)及无序关联(Unordered associative)容器的索引(Index)
    std::hash<std::type_index> std::hash 函数对 std::type_index 类型的特例化
  • hash 哈希函数对象
  • namespace std {
        class type_index;
        template <class T> struct hash;
        template<> struct hash<type_index>;
    }
  • 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;
        bool operator>= (const type_index& rhs) const noexcept;
        size_t hash_code() const;
        const char* name() const;
    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.
    };