Namespaces
Variants

std::type_index::operator==,!=,<,<=,>,>=,<=>

ja.cppreference.net より
 
 
ユーティリティライブラリ
言語サポート
型サポート (基本型、RTTI)
ライブラリ機能テストマクロ (C++20)
プログラムユーティリティ
可変引数関数
コルーチンサポート (C++20)
契約サポート (C++26)
三方比較
(C++20)
(C++20)(C++20)(C++20)    
(C++20)(C++20)(C++20)

汎用ユーティリティ
関係演算子 (C++20で非推奨)
整数比較関数
(C++20)(C++20)(C++20)    
(C++20)
Swap と 型操作
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
共通語彙型
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++17)
(C++23)



 
 
 
bool operator==( const type_index& rhs ) const noexcept;
(1) (C++11以上)
bool operator!=( const type_index& rhs ) const noexcept;
(2) (C++11以上)
(C++20未満)
bool operator<( const type_index& rhs ) const noexcept;
(3) (C++11以上)
bool operator<=( const type_index& rhs ) const noexcept;
(4) (C++11以上)
bool operator>( const type_index& rhs ) const noexcept;
(5) (C++11以上)
bool operator>=( const type_index& rhs ) const noexcept;
(6) (C++11以上)
std::strong_ordering operator<=>( const type_index& rhs ) const noexcept;
(7) (C++20以上)

基となる std::type_info オブジェクトを比較します。

1,2) 基となる std::type_info オブジェクトが同じ型を参照しているか確認します。
3-7) 実装定義の順序に従って、基となる std::type_info オブジェクトを比較します。比較は type_info::before によって行われます。

上記の != 演算子は から 合成operator==されます。

(C++20以上)

パラメータ

rhs - 比較対象の別の type_index オブジェクト

戻り値

1) true 基礎となる std::type_info オブジェクトが同じ型を参照している場合、 false それ以外の場合。
2) true 基礎となる std::type_info オブジェクトが同じ型を参照していない場合、 false それ以外の場合。
3-6) true 基礎となる std::type_info オブジェクトが参照する型が対応する順序で並んでいる場合は false それ以外の場合。
7) std :: strong_ordering :: equal 基底の std::type_info オブジェクトが同じ型を参照する場合、そうでない場合は std :: strong_ordering :: less 、 * this の基底 std::type_info オブジェクトが実装定義の順序で rhs のオブジェクトより先行する場合、そうでない場合は std :: strong_ordering :: greater 。