[type.info]

# 17 Language support library [[support]](./#support)

## 17.7 Type identification [[support.rtti]](support.rtti#type.info)

### 17.7.3 Class type_info [type.info]

[ð](#lib:type_info)

namespace std {class type_info {public:virtual ~type_info(); constexpr bool operator==(const type_info& rhs) const noexcept; bool before(const type_info& rhs) const noexcept;
 size_t hash_code() const noexcept; const char* name() const noexcept;

 type_info(const type_info&) = delete;
 type_info& operator=(const type_info&) = delete; };}

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3306)

The classtype_info describes type information generated by the implementation ([[expr.typeid]](expr.typeid "7.6.1.8 Type identification"))[.](#1.sentence-1)

Objects of this class effectively store a pointer to a name for the type, and
an encoded value suitable for comparing two types for equality or collating order[.](#1.sentence-2)

The names, encoding rule, and collating sequence for types are all unspecifiedand may differ between programs[.](#1.sentence-3)

[ð](#lib:operator==,type_info)

`constexpr bool operator==(const type_info& rhs) const noexcept;
`

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3322)

*Effects*: Compares the current object with rhs[.](#2.sentence-1)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3326)

*Returns*: true if the two values describe the same type[.](#3.sentence-1)

[ð](#lib:before,type_info)

`bool before(const type_info& rhs) const noexcept;
`

[4](#4)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3338)

*Effects*: Compares the current object with rhs[.](#4.sentence-1)

[5](#5)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3342)

*Returns*: true if*this precedes rhs in the implementation's collation order[.](#5.sentence-1)

[ð](#lib:hash_code,type_info)

`size_t hash_code() const noexcept;
`

[6](#6)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3356)

*Returns*: An unspecified value, except that within a single execution of the
program, it shall return the same value for any two type_info objects which compare equal[.](#6.sentence-1)

[7](#7)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3362)

*Remarks*: An implementation should return different values for twotype_info objects which do not compare equal[.](#7.sentence-1)

[ð](#lib:name,type_info)

`const char* name() const noexcept;
`

[8](#8)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3375)

*Returns*: An implementation-defined ntbs[.](#8.sentence-1)

[9](#9)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L3379)

*Remarks*: The message may be a[null-terminated multibyte string](multibyte.strings#def:ntmbs "16.3.3.3.4.3 Multibyte strings [multibyte.strings]"),
suitable for conversion and display as awstring ([[string.classes]](string.classes "27.4 String classes"), [[locale.codecvt]](locale.codecvt "28.3.4.2.5 Class template codecvt"))[.](#9.sentence-1)
