Namespaces
Variants

std:: strong_order

From cppreference.net
Utilities library
ヘッダーで定義 <compare>
inline namespace /* unspecified */ {

inline constexpr /* unspecified */ strong_order = /* unspecified */ ;

}
(C++20以降)
呼び出しシグネチャ
template < class T, class U >

requires /* see below */

constexpr std:: strong_ordering strong_order ( T && t, U && u ) noexcept ( /* 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 ) ) (適切な式である場合)
  • その他のすべての場合、式は不適格となり、テンプレートのインスタンス化の直接の文脈で現れる場合 置換失敗 を引き起こす可能性がある。

目次

翻訳内容: - "Contents" → "目次" - "Customization point objects" → 翻訳せず(C++専門用語のため) - "Strict total order of IEEE floating-point types" → 翻訳せず(C++専門用語のため) - "Example" → "例" - "See also" → "関連項目" HTMLタグ、属性、構造はすべてそのまま保持し、指定された条件に従って翻訳を行いました。

カスタマイゼーションポイントオブジェクト

名前 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 ) となる。

関連項目

すべての6つの演算子をサポートし、置換可能な3方向比較の結果型
(クラス)
(C++20)
3方向比較を実行し、型 std::weak_ordering の結果を生成する
(カスタマイゼーションポイントオブジェクト)
3方向比較を実行し、型 std::partial_ordering の結果を生成する
(カスタマイゼーションポイントオブジェクト)
3方向比較を実行し、型 std::strong_ordering の結果を生成する( operator <=> が利用できない場合でも)
(カスタマイゼーションポイントオブジェクト)