std:: strong_order
|
ヘッダーで定義
<compare>
|
||
|
inline
namespace
/* unspecified */
{
inline
constexpr
/* unspecified */
strong_order
=
/* unspecified */
;
|
(C++20以降) | |
|
呼び出しシグネチャ
|
||
|
template
<
class
T,
class
U
>
requires
/* see below */
|
||
3方向比較を使用して2つの値を比較し、型
std::strong_ordering
の結果を生成します。
t
と
u
を式とし、
T
と
U
がそれぞれ
decltype
(
(
t
)
)
と
decltype
(
(
u
)
)
を表すとき、
std
::
strong_order
(
t, u
)
は以下の式と
式等価
です:
-
std::
is_same_v
<
std::
decay_t
<
T
>
,
std::
decay_t
<
U
>>
が
true
の場合:
-
std::
strong_ordering
(
strong_order
(
t, u
)
)
(
std::strong_orderの宣言を含まない文脈でオーバーロード解決を行った際に適切な式である場合) -
それ以外の場合、
Tが浮動小数点型の場合:- std:: numeric_limits < T > :: is_iec559 が true の場合、浮動小数点値のISO/IEC/IEEE 60559 totalOrder 比較を実行し、その結果を std::strong_ordering 型の値として返す(注: この比較は正のゼロと負のゼロ、および異なる表現を持つNaNを区別できる)
-
それ以外の場合、
Tの比較演算子によって観測される順序付けと一致する std::strong_ordering 型の値を生成する
- それ以外の場合、 std:: strong_ordering ( std:: compare_three_way ( ) ( t, u ) ) (適切な式である場合)
-
std::
strong_ordering
(
strong_order
(
t, u
)
)
(
- その他のすべての場合、式は不適格となり、テンプレートのインスタンス化の直接の文脈で現れる場合 置換失敗 を引き起こす可能性がある。
目次 |
カスタマイゼーションポイントオブジェクト
名前
std::strong_order
は
カスタマイゼーションポイントオブジェクト
を表し、これは
関数オブジェクト
のconstな
リテラル
semiregular
クラス型である。詳細は
CustomizationPointObject
を参照。
IEEE浮動小数点型の厳密な全順序
x と y を同じIEEE浮動小数点型の値とし、 total_order_less ( x, y ) を、ISO/IEC/IEEE 60559の totalOrder によって定義される厳密な全順序において x が y に先行するかどうかを示すブーリアン結果とする。
( total_order_less ( x, y ) || total_order_less ( y, x ) ) == false が成り立つのは、 x と y が同じビットパターンを持つ場合に限ります。
-
x
も
y
もNaNでない場合:
- x < y の場合、 total_order_less ( x, y ) == true となる;
- x > y の場合、 total_order_less ( x, y ) == false となる;
-
x
==
y
の場合、
- x が負のゼロで y が正のゼロの場合、 total_order_less ( x, y ) == true となる、
- x がゼロでなく、かつ x の指数部が y の指数部より小さい場合、 total_order_less ( x, y ) == ( x > 0 ) となる(十進浮動小数点数でのみ意味を持つ);
-
x
または
y
のいずれかがNaNの場合:
- x が負のNaNで y が負のNaNでない場合、 total_order_less ( x, y ) == true となる、
- x が正のNaNでなく、かつ y が正のNaNの場合、 total_order_less ( x, y ) == true となる、
- x と y が同じ符号のNaNで、かつ x の仮数部が y の仮数部より小さい場合、 total_order_less ( x, y ) == ! std:: signbit ( x ) となる。
例
|
このセクションは不完全です
理由: 例がありません |
関連項目
|
(C++20)
|
すべての6つの演算子をサポートし、置換可能な3方向比較の結果型
(クラス) |
|
(C++20)
|
3方向比較を実行し、型
std::weak_ordering
の結果を生成する
(カスタマイゼーションポイントオブジェクト) |
|
(C++20)
|
3方向比較を実行し、型
std::partial_ordering
の結果を生成する
(カスタマイゼーションポイントオブジェクト) |
|
(C++20)
|
3方向比較を実行し、型
std::strong_ordering
の結果を生成する(
operator
<=>
が利用できない場合でも)
(カスタマイゼーションポイントオブジェクト) |