type_index 類別

type_index 類別會將指標包裝到 type_info Class 來協助這類物件的索引。

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; };

建構函式會將 ptr 初始化為 &tinfo。

name 傳回 ptr->name()。

hash_code 傳回 ptr->hash_code()。

operator== 傳回 *ptr == right.ptr。

operator!= 傳回 !(*this == right)。

operator< 傳回 *ptr->before(*right.ptr)。

operator<= 傳回 !(right < *this)。

operator> 傳回 right < *this。

operator>= 傳回 !(*this < right)。

另請參閱

執行階段類型資訊
<typeindex>