public member function
<typeindex>

std::type_index::hash_code

size_t hash_code() const;
Get type hash code
Returns a hash code value that identifies the type currently referenced to by the object.

Internally, the function simply returns the result of calling member hash_code on the type_info it refers to.

This function returns the same value for any two type_index objects that compare equal.

Parameters

none

Return Value

A value that identifies the type (runtime constant).
size_t is an unsigned integral type.

Data races

No data races are initiated by this member function.

Exception safety

If the object refers to a valid type_info object, this member function never throws exceptions (no-throw guarantee).
Otherwise, it causes undefined behavior.

See also