# std::type_info

> C++ Atlas: `cppatlas.com/w/cpp/types/type_info` | Source: https://en.cppreference.com/w/cpp/types/type_info | Domain: Type support | Standards: C++11, C++20

The class type_info holds implementation-specific information about a type, including the name of the type and means to compare two types for equality or collating order.

## Official Specification Summary (cppreference)

```cpp
// Defined in header <typeinfo>
class type_info;
```

The class `type_info` holds implementation-specific information about a type, including the name of the type and means to compare two types for equality or collating order. This is the class returned by the `typeid` operator.

The `type_info` class is neither *CopyConstructible* nor *CopyAssignable*.

### Member functions

- (constructor) [deleted]: has neither default nor copy constructors (public member function)
- (destructor) [virtual]: the virtual destructor makes `type_info` a polymorphic class (virtual public member function)
- `operator=` [deleted]: can not be copy-assigned (public member function)
- `operator==`, `operator!=` (removed in C++20): checks whether the objects refer to the same type (public member function)
- `before`: checks whether the referred type precedes referred type of another `type_info` object in the implementation defined order, i.e. orders the referred types (public member function)
- `hash_code` (C++11): returns a value which is identical for the same types (public member function)
- `name`: implementation defined name of the type (public member function)

### See also

- [`type_index`](https://en.cppreference.com/w/cpp/types/type_index) (C++11): wrapper around a `type_info` object, that can be used as index in associative and unordered associative containers (class)
- [`typeid`](https://en.cppreference.com/w/cpp/language/typeid): Queries information of a type, returning a `std::type_info` object representing the type (built-in operator)

---
Attribution: content from https://en.cppreference.com/w/cpp/types/type_info (cppreference.com), licensed under CC-BY-SA 3.0 and GFDL. Modified: converted to markdown, study notes added. Offline snapshot of 9 February 2025.