Movatterモバイル変換


[0]ホーム

URL:


cppreference.com
Namespaces
Variants
    Actions

      std::ranges::less

      From cppreference.com
      <cpp‎ |utility‎ |functional
       
       
      Utilities library
       
      Function objects
      Function invocation
      (C++17)(C++23)
      Identity function object
      (C++20)
      Old binders and adaptors
      (until C++17*)
      (until C++17*)
      (until C++17*)
      (until C++17*)  
      (until C++17*)
      (until C++17*)(until C++17*)(until C++17*)(until C++17*)
      (until C++20*)
      (until C++20*)
      (until C++17*)(until C++17*)
      (until C++17*)(until C++17*)

      (until C++17*)
      (until C++17*)(until C++17*)(until C++17*)(until C++17*)
      (until C++20*)
      (until C++20*)
       
      Defined in header<functional>
      struct less;
      (since C++20)

      Function object for performing comparisons. Deduces the parameter types of the function call operator from the arguments (but not the return type).

      Contents

      [edit]Nested types

      Nested type Definition
      is_transparentunspecified

      [edit]Member functions

      operator()
      checks if the first argument isless than the second
      (public member function)

      std::ranges::less::operator()

      template<class T,class U>
      constexprbool operator()( T&& t, U&& u)const;

      Given the expressionstd::forward<T>(t)<std::forward<U>(u) asexpr:

      • Otherwise:

      This overload participates in overload resolution only ifstd::totally_ordered_with<T, U> is satisfied.

      If there exists an expressionexpr1 of typeT and an expressionexpr2 ofU, such that the comparison results ofexpr1 andexpr2 violatestrict total ordering (rules are defined below), the behavior is undefined.

      The comparison results ofexpr1 andexpr2 follow strict total ordering only ifexactly one of the following expressions istrue:

      [edit]Notes

      Unlikestd::less,std::ranges::less requires all six comparison operators<,<=,>,>=,== and!= to be valid (via thetotally_ordered_with constraint).

      [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 3530C++20syntactic checks were relaxed while comparing pointersonly semantic requirements are relaxed

      [edit]See also

      function object implementingx< y
      (class template)[edit]
      Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/utility/functional/ranges/less&oldid=167679"

      [8]ページ先頭

      ©2009-2025 Movatter.jp