std::weak_order
| ヘッダ <compare>
|
||
inline namespace /* unspecified */ {
inline constexpr /* unspecified */ weak_order = /* unspecified */;
}
|
で定義 (C++20 以上) | |
| 呼び出しシグネチャ |
||
template< class T, class U >
requires /* see below */
constexpr std::weak_ordering weak_order(T&& t, U&& u) noexcept(/* see below */);
|
||
三方比較を使用して2つの値を比較し、型 std::weak_ordering の結果を生成します。
t と u を式、T と U をそれぞれ decltype((t)) と decltype((u)) の型として、std::weak_order(t, u) は次の式と等価です:
std::is_same_v<std::decay_t<T>, std::decay_t<U>>がtrueの場合:std::weak_ordering(weak_order(t, u))、ただし、これは well-formed な式であり、オーバーロード解決がstd::weak_orderの宣言を含まないコンテキストで行われる場合、- そうでなく、
Tが浮動小数点型の場合:std::numeric_limits<T>::is_iec559がtrueの場合、浮動小数点値の弱順序比較(以下を参照)を実行し、その結果を型std::weak_orderingの値として返します。- それ以外の場合、
std::weak_orderingの比較演算子で観測される順序と一致する型Tの値を生成します。
- それ以外の場合、
std::weak_ordering(std::compare_three_way()(t, u))(well-formed な場合)、 - それ以外の場合、
std::weak_ordering(std::strong_order(t, u))(well-formed な場合)。
- その他のすべての場合、式は ill-formed となり、テンプレートの実体化の即時コンテキストに現れた場合に置換失敗を引き起こす可能性があります。
カスタマイゼーションポイントオブジェクト
名前
std::weak_order
は
カスタマイゼーションポイントオブジェクト
を表し、これは
関数オブジェクト
のconstな
リテラル
semiregular
クラス型である。詳細は
CustomizationPointObject
を参照のこと。
IEEE浮動小数点型の厳密弱順序
x と y を同じIEEE浮動小数点型の値とし、 weak_order_less ( x, y ) を、C++標準で定義された厳密弱順序において x が y に先行するかどうかを示すブーリアン結果とする。
- x と y のどちらもNaNでない場合、 weak_order_less ( x, y ) == true は x < y と同値である。すなわち、等しい浮動小数点値のすべての表現は等価である。
- x が負のNaNであり、 y が負のNaNでない場合、 weak_order_less ( x, y ) == true である。
- x が正のNaNでなく、 y が正のNaNである場合、 weak_order_less ( x, y ) == true である。
- x と y の両方が同じ符号のNaNである場合、 ( weak_order_less ( x, y ) || weak_order_less ( y, x ) ) == false である。すなわち、同じ符号を持つすべてのNaNは等価である。
例
|
このセクションは不完全です
理由: 例がありません |
関連項目
|
(C++20)
|
すべての6つの演算子をサポートし、置換可能ではない3方向比較の結果型
(クラス) |
|
(C++20)
|
3方向比較を実行し、型
std::strong_ordering
の結果を生成する
(カスタマイゼーションポイントオブジェクト) |
|
(C++20)
|
3方向比較を実行し、型
std::partial_ordering
の結果を生成する
(カスタマイゼーションポイントオブジェクト) |
|
(C++20)
|
3方向比較を実行し、型
std::weak_ordering
の結果を生成する(
operator
<=>
が利用できない場合でも)
(カスタマイゼーションポイントオブジェクト) |