Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::compare_partial_order_fallback

      From cppreference.com
      <cpp‎ |utility
       
       
      Utilities library
       
      Defined in header<compare>
      inlinenamespace/* unspecified */{

         inlineconstexpr/* unspecified */
              compare_partial_order_fallback=/* unspecified */;

      }
      (since C++20)
      Call signature
      template<class T,class U>

          requires/* see below */
      constexprstd::partial_ordering

          compare_partial_order_fallback( T&& t, U&& u)noexcept(/* see below */);
      (since C++20)

      Performs three-way comparison onsubexpressionst andu and produces a result of typestd::partial_ordering, even if the operator<=> is unavailable.

      Ifstd::decay_t<T> andstd::decay_t<U>> are the same type,std::compare_partial_order_fallback(t, u) isexpression-equivalent to:

      • std::partial_order(t, u), if it is a well-formed expression;
      • otherwise,t== u? std::partial_ordering::equivalent:
        t< u  ? std::partial_ordering::less:
        u< t  ? std::partial_ordering::greater:
                 std::partial_ordering::unordered
        , if the expressionst== u,t< u andu< t are all well-formed and each ofdecltype(t== u),decltype(t< u) anddecltype(u< t) modelsboolean-testable, except thatt andu are evaluated only once.

      In all other cases,std::compare_partial_order_fallback(t, u) is ill-formed, which can result insubstitution failure when it appears in the immediate context of a template instantiation.

      Contents

      Customization point objects

      The namestd::compare_partial_order_fallback denotes acustomization point object, which is a constfunction object of aliteralsemiregular class type. SeeCustomizationPointObject for details.

      [edit]Example

      This section is incomplete
      Reason: no example

      [edit]Defect reports

      The following behavior-changing defect reports were applied retroactively to previously published C++ standards.

      DRApplied toBehavior as publishedCorrect behavior
      LWG 2114
      (P2167R3)
      C++20the fallback mechanism only required
      return types to be convertible tobool
      constraints strengthened
      LWG 3465C++20the fallback mechanism did not requireu< t to be well-formedrequired
      LWG 4157C++20P2167R3 overwrote the resolution ofLWG issue 3465restored the resolution

      [edit]See also

      performs 3-way comparison and produces a result of typestd::partial_ordering
      (customization point object)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/utility/compare/compare_partial_order_fallback&oldid=180948"

      [8]ページ先頭

      ©2009-2025 Movatter.jp