std:: weak_order
|
ヘッダーで定義
<compare>
|
||
|
inline
namespace
/* unspecified */
{
inline
constexpr
/* unspecified */
weak_order
=
/* unspecified */
;
|
(C++20以降) | |
|
呼び出しシグネチャ
|
||
|
template
<
class
T,
class
U
>
requires
/* see below */
|
||
2つの値を3方向比較を使用して比較し、型
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
)
)
(ただし、これは
std::weak_orderの宣言を含まない文脈でオーバーロード解決が行われた場合に適切な式であること) -
そうでなく、
Tが浮動小数点型の場合:-
std::
numeric_limits
<
T
>
::
is_iec559
が
true
の場合、浮動小数点値の弱順序比較を実行し(下記参照)、その結果を
std::weak_ordering型の値として返す -
そうでない場合、
Tの比較演算子によって観測される順序と整合性のあるstd::weak_ordering型の値を生成する
-
std::
numeric_limits
<
T
>
::
is_iec559
が
true
の場合、浮動小数点値の弱順序比較を実行し(下記参照)、その結果を
- そうでなく、 std:: weak_ordering ( std:: compare_three_way ( ) ( t, u ) ) が適切な式である場合
- そうでなく、 std:: weak_ordering ( std:: strong_order ( t, u ) ) が適切な式である場合
-
std::
weak_ordering
(
weak_order
(
t, u
)
)
(ただし、これは
- その他のすべての場合、式は不適格となり、テンプレートのインスタンス化の直接の文脈で現れる場合 置換失敗 を引き起こす可能性がある
目次 |
カスタマイゼーションポイントオブジェクト
名前
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
<=>
が利用できない場合でも)
(カスタマイゼーションポイントオブジェクト) |