Namespaces
Variants

std:: compare_strong_order_fallback

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

inline constexpr /* unspecified */
compare_strong_order_fallback = /* unspecified */ ;

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

requires /* see below */
constexpr std:: strong_ordering

compare_strong_order_fallback ( T && t, U && u ) noexcept ( /* see below */ ) ;
(C++20以降)

部分式 t u に対して三方比較を実行し、演算子 <=> が利用できない場合でも、 std::strong_ordering 型の結果を生成します。

std:: decay_t < T > std:: decay_t < U > が同じ型である場合、 std :: compare_strong_order_fallback ( t, u ) 式等価 です:

  • std:: strong_order ( t, u ) 、これが適切な式である場合;
  • そうでない場合、 t == u ? std :: strong_ordering :: equal :
    t < u ? std :: strong_ordering :: less :
    std :: strong_ordering :: greater
もし式 t == u および t < u が両方とも適切に形成され、かつ decltype ( t == u ) decltype ( t < u ) のそれぞれが boolean-testable をモデル化する場合。ただし、 t u は一度だけ評価される。

それ以外のすべての場合において、 std :: compare_strong_order_fallback ( t, u ) は ill-formed となり、これはテンプレートのインスタンス化の直接の文脈で現れた場合、 置換失敗 を引き起こす可能性があります。

目次

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

名前 std::compare_strong_order_fallback カスタマイゼーションポイントオブジェクト を表し、これは 関数オブジェクト のconstな リテラル semiregular クラス型である。詳細は CustomizationPointObject を参照。

欠陥報告

以下の動作変更の欠陥報告書は、以前に公開されたC++規格に対して遡及的に適用されました。

DR 適用対象 公開時の動作 正しい動作
LWG 2114
( P2167R3 )
C++20 フォールバック機構は戻り値の型が
bool に変換可能であることのみを要求
制約が強化された

関連項目

3方向比較を実行し、型 std::strong_ordering の結果を生成する
(カスタマイゼーションポイントオブジェクト)