Namespaces
Variants

std::operator==,!=,<,<=>(std::error_code)

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)
スワップと型操作
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
共通ボキャブラリ型
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++17)
(C++23)



 
 
 
ヘッダ <system_error>
bool operator==( const std::error_code& lhs,
                 const std::error_code& rhs ) noexcept;
で定義 (1)
bool operator!=( const std::error_code& lhs,
                 const std::error_code& rhs ) noexcept;
(C++11以上) (2)
(C++11以上)
bool operator<( const std::error_code& lhs,
                const std::error_code& rhs ) noexcept;
(C++20まで) (3)
(C++11以上)
std::strong_ordering operator<=>( const std::error_code& lhs,
                                  const std::error_code& rhs ) noexcept;
(C++20まで) (4)

(C++20以上)

2つのエラーコードオブジェクトを比較します。 1)lhs rhs と
が等しいかどうか比較します。2)lhs rhs と
が等しいかどうか比較します。3)lhs rhs が
より小さいかどうか調べます。4)lhs rhs と

の三方比較結果を取得します。<, <=, >, >=, != の各演算子は、それぞれ と からoperator<=>合成されますoperator==。

(C++20以上)

パラメータ

lhs, rhs - 比較するエラーコード

戻り値

1) true エラーカテゴリとエラー値が等しい場合。
2) true エラーカテゴリまたはエラー値の比較が等しくない場合。
3) true が lhs. category ( ) < rhs. category ( ) の場合。それ以外の場合、 true が lhs. category ( ) == rhs. category ( ) && lhs. value ( ) < rhs. value ( ) の場合。それ以外の場合、 false 。
4) lhs. category ( ) <=> rhs. category ( ) それが std :: strong_ordering :: equal でない場合。それ以外の場合、 lhs. value ( ) <=> rhs. value ( ) 。

関連項目

このerror_codeのerror_categoryを取得する
(public member function)
error_code の値を取得する
(public member function)
(removed in C++20) (removed in C++20) (C++20)
error_condition と error_code を比較する
(function)