##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# Standard library header <typeindex>

From cppreference.com
< cpp‎ | header

This header is part of the types support library.

### [edit] Classes

type_index (C++11) | wrapper around a `type_info` object, that can be used as index in associative and unordered associative containers (class) [edit]
std::hash<std::type_index> (C++11) | hash support for std::type_index (class template specialization) [edit]
##### Forward declarations
Defined in header `<functional>`
hash (C++11) | hash function object (class template) [edit]

### [edit] Synopsis

    namespace std {
        class type_index;
        template <class T> struct hash;
        template<> struct hash<type_index>;
    }

#### [edit] Class std::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.
    };

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/header/typeindex&oldid=90194"