Заголовок стандартной библиотеки <typeindex> (C++11)
Этот заголовок входит в библиотеку поддержки типов.
Подключаемые заголовки |
|
|
(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.
};
}
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/header/typeindex