名前空間
変種
操作

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

From cppreference.com
< cpp‎ | types‎ | type index
 
 
ユーティリティライブラリ
言語サポート
型のサポート (基本型、RTTI)
ライブラリ機能検査マクロ (C++20)
プログラムユーティリティ
可変引数関数
コルーチンサポート (C++20)
契約サポート (C++26)
三方比較
(C++20)
(C++20)(C++20)(C++20)  
(C++20)(C++20)(C++20)

汎用ユーティリティ
関係演算子 (C++20で非推奨)
 
 
std::type_index
メンバ関数
type_index::operator=type_index::operator!=type_index::operator<type_index::operator<=type_index::operator>type_index::operator>=type_index::operator<=>
(C++20まで)(C++20以降)
ヘルパークラス
 
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) 基になる std::type_info オブジェクトが同じ型を参照している場合は true、そうでない場合は false
2) 基になる std::type_info オブジェクトが同じ型を参照していない場合は true、そうでない場合は false
3-6) 対応する順序で型が並べ替えられている場合は true、そうでない場合は false
7) 基になる std::type_info オブジェクトが同じ型を参照している場合は std::strong_ordering::equal。そうでない場合、*this の基になる std::type_info オブジェクトが実装定義の順序で `rhs` の前に来る場合は std::strong_ordering::less、それ以外の場合は std::strong_ordering::greater
English 日本語 中文(简体) 中文(繁體)