Skip to content

Latest commit

 

History

History
48 lines (34 loc) · 1.27 KB

type-index-class.md

File metadata and controls

48 lines (34 loc) · 1.27 KB
title description ms.date f1_keywords helpviewer_keywords ms.custom
type_index Class
Learn more about: type_index Class
06/20/2022
typeindex/std::type_index
type_index class
devdivchpfy22

type_index Class

The type_index class wraps a pointer to type_info Class to assist in indexing by such objects.

class type_index { public: type_index(const type_info& tinfo); const char *name() const; size_t hash_code() const; bool operator==(const type_info& right) const; bool operator!=(const type_info& right) const; bool operator<(const type_info& right) const; bool operator<=(const type_info& right) const; bool operator>(const type_info& right) const; bool operator>=(const type_info& right) const; };

The constructor initializes ptr to &tinfo.

name returns ptr->name().

hash_code returns ptr->hash_code().

operator== returns *ptr == right.ptr.

operator!= returns !(*this == right).

operator< returns *ptr->before(*right.ptr).

operator<= returns !(right < *this).

operator> returns right < *this.

operator>= returns !(*this < right).

See also

Run-Time Type Information
<typeindex>