std::weak_order
提供: cppreference.com
| ヘッダ <compare> で定義
|
||
| template< class T > constexpr std::weak_ordering weak_order(const T& a, const T& b); |
(C++20以上) | |
三方比較を用いて2つの値を比較し、 std::weak_ordering 型の結果を生成します。
具体的には、
- 式 a <=> b が well-formed であり、その結果が std::weak_ordering に変換可能であれば、その結果を返します。
- そうでなく、式 a <=> b は well-formed だけれども、その結果が std::weak_ordering に変換可能でなければ、この関数は削除されたものとして定義されます。
- そうでなく、式 a <=> b は ill-formed だけれども、式 a == b と a < b がどちらも well-formed であり、 bool に変換可能であれば、
- a == b が true であれば、 std::weak_ordering::equivalent を返します。
- そうでなく、 a < b が true であれば、 std::weak_ordering::less を返します。
- そうでなければ、 std::weak_ordering::greater を返します。
- そうでなければ、この関数は削除されたものとして定義されます。
目次 |
[編集] 引数
| a, b | - | 比較する値 |
[編集] 戻り値
上で説明した通りの std::weak_ordering 型の値。
[編集] ノート
[編集] 例
| This section is incomplete Reason: no example |
[編集] 関連項目
| (C++20) |
6種類の演算子をすべてサポートする代用可能でない三方比較の結果の型 (クラス) |
| (C++20) |
三方比較を行い std::strong_ordering 型の結果を返します (関数テンプレート) |
| (C++20) |
三方比較を行い std::partial_ordering 型の結果を返します (関数テンプレート) |
| (C++20) |
三方比較を行い std::weak_equality 型の結果を返します (関数テンプレート) |

