20 General utilities library [utilities]

20.14 Function objects [function.objects]

20.14.8 Concept-constrained comparisons [range.cmp]

In this subclause, BUILTIN-PTR-CMP(T, op, U) for types T and U and where op is an equality ([expr.eq]) or relational operator ([expr.rel]) is a boolean constant expression.
BUILTIN-PTR-CMP(T, op, U) is true if and only if op in the expression declval<T>() op declval<U>() resolves to a built-in operator comparing pointers.
There is an implementation-defined strict total ordering over all pointer values of a given type.
This total ordering is consistent with the partial order imposed by the builtin operators <, >, <=, >=, and <=>.
struct ranges::equal_to { template<class T, class U> requires equality_comparable_with<T, U> || BUILTIN-PTR-CMP(T, ==, U) constexpr bool operator()(T&& t, U&& u) const; using is_transparent = unspecified; };
Expects: If the expression std​::​forward<T>(t) == std​::​forward<U>(u) results in a call to a built-in operator == comparing pointers of type P, the conversion sequences from both T and U to P shall be equality-preserving ([concepts.equality]).
Effects:
  • If the expression std​::​forward<T>(t) == std​::​forward<U>(u) results in a call to a built-in operator == comparing pointers of type P: returns false if either (the converted value of) t precedes u or u precedes t in the implementation-defined strict total order over pointers of type P and otherwise true.
  • Otherwise, equivalent to: return std​::​forward<T>(t) == std​::​forward<U>(u);
struct ranges::not_equal_to { template<class T, class U> requires equality_comparable_with<T, U> || BUILTIN-PTR-CMP(T, ==, U) constexpr bool operator()(T&& t, U&& u) const; using is_transparent = unspecified; };
operator() has effects equivalent to:
return !ranges::equal_to{}(std::forward<T>(t), std::forward<U>(u));
struct ranges::greater { template<class T, class U> requires totally_ordered_with<T, U> || BUILTIN-PTR-CMP(U, <, T) constexpr bool operator()(T&& t, U&& u) const; using is_transparent = unspecified; };
operator() has effects equivalent to:
return ranges::less{}(std::forward<U>(u), std::forward<T>(t));
struct ranges::less { template<class T, class U> requires totally_ordered_with<T, U> || BUILTIN-PTR-CMP(T, <, U) constexpr bool operator()(T&& t, U&& u) const; using is_transparent = unspecified; };
Expects: If the expression std​::​forward<T>(t) < std​::​forward<U>(u) results in a call to a built-in operator < comparing pointers of type P, the conversion sequences from both T and U to P shall be equality-preserving ([concepts.equality]).
For any expressions ET and EU such that decltype((ET)) is T and decltype((EU)) is U, exactly one of ranges​::​less{}(ET, EU), ranges​::​less{}(EU, ET), or ranges​::​equal_­to{}(ET, EU) shall be true.
Effects:
  • If the expression std​::​forward<T>(t) < std​::​forward<U>(u) results in a call to a built-in operator < comparing pointers of type P: returns true if (the converted value of) t precedes u in the implementation-defined strict total order over pointers of type P and otherwise false.
  • Otherwise, equivalent to: return std​::​forward<T>(t) < std​::​forward<U>(u);
struct ranges::greater_equal { template<class T, class U> requires totally_ordered_with<T, U> || BUILTIN-PTR-CMP(T, <, U) constexpr bool operator()(T&& t, U&& u) const; using is_transparent = unspecified; };
operator() has effects equivalent to:
return !ranges::less{}(std::forward<T>(t), std::forward<U>(u));
struct ranges::less_equal { template<class T, class U> requires totally_ordered_with<T, U> || BUILTIN-PTR-CMP(U, <, T) constexpr bool operator()(T&& t, U&& u) const; using is_transparent = unspecified; };
operator() has effects equivalent to:
return !ranges::less{}(std::forward<U>(u), std::forward<T>(t));