20 General utilities library [utilities] (original) (raw)

20.14 Function objects [function.objects]

20.14.9 Concept-constrained comparisons [range.cmp]

In this subclause, BUILTIN-PTR-CMP(T, op, U) for types Tand 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 opin the expression declval<T>() op declval<U>() resolves to a built-in operator comparing pointers.

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_;};

Preconditions: If the expression std​::​forward<T>(t) == std​::​forward<U>(u)results in a call to a built-in operator == comparing pointers of typeP, the conversion sequences from both T and U to Pare equality-preserving ([concepts.equality]).

Effects:

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](concept.totallyordered#concept:totally%5Fordered%5Fwith "18.5.4 Concept totally_­ordered [concept.totallyordered]")<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](concept.totallyordered#concept:totally%5Fordered%5Fwith "18.5.4 Concept totally_­ordered [concept.totallyordered]")<T, U> || _BUILTIN-PTR-CMP_(T, <, U) constexpr bool operator()(T&& t, U&& u) const;using is_transparent = _unspecified_;};

Preconditions: 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 are equality-preserving ([concepts.equality]).

For any expressionsET and EU such that decltype((ET)) is T anddecltype((EU)) is U, exactly one ofranges​::​less{}(ET, EU),ranges​::​less{}(EU, ET), orranges​::​equal_­to{}(ET, EU)is true.

Effects:

struct ranges::greater_equal { template<class T, class U> requires [totally_­ordered_­with](concept.totallyordered#concept:totally%5Fordered%5Fwith "18.5.4 Concept totally_­ordered [concept.totallyordered]")<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](concept.totallyordered#concept:totally%5Fordered%5Fwith "18.5.4 Concept totally_­ordered [concept.totallyordered]")<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));