共用方式為


type_index 類別

type_index 類別會封裝指標 type_info 類別 協助索引由這類物件。

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>