Files
cppdraft_translate/cppdraft/range/cmp.md
2025-10-25 03:02:53 +03:00

7.2 KiB
Raw Blame History

[range.cmp]

22 General utilities library [utilities]

22.10 Function objects [function.objects]

22.10.9 Concept-constrained comparisons [range.cmp]

🔗

struct ranges::equal_to {template<class T, class U>constexpr bool operator()(T&& t, U&& u) const; using is_transparent = unspecified;};

🔗

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

1

#

Constraints: T and U satisfy equality_comparable_with.

2

#

Preconditions: If the expression std::forward(t) == std::forward(u) results in a call to a built-in operator == comparing pointers of typeP, the conversion sequences from both T and U to P are equality-preserving ([concepts.equality]); otherwise, T and U model equality_comparable_with.

3

#

Effects:

If the expression std::forward(t) == std::forward(u) results in a call to a built-in operator == comparing pointers: returns false if either (the converted value of) t precedes u or u precedes t in the implementation-defined strict total order over pointers ([defns.order.ptr]) and otherwise true.

Otherwise, equivalent to: return std::forward(t) == std::forward(u);

🔗

struct ranges::not_equal_to {template<class T, class U>constexpr bool operator()(T&& t, U&& u) const; using is_transparent = unspecified;};

🔗

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

4

#

Constraints: T and U satisfy equality_comparable_with.

5

#

Effects: Equivalent to:return !ranges::equal_to{}(std::forward(t), std::forward(u));

🔗

struct ranges::greater {template<class T, class U>constexpr bool operator()(T&& t, U&& u) const; using is_transparent = unspecified;};

🔗

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

6

#

Constraints: T and U satisfy totally_ordered_with.

7

#

Effects: Equivalent to:return ranges::less{}(std::forward(u), std::forward(t));

🔗

struct ranges::less {template<class T, class U>constexpr bool operator()(T&& t, U&& u) const; using is_transparent = unspecified;};

🔗

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

8

#

Constraints: T and U satisfy totally_ordered_with.

9

#

Preconditions: If the expression std::forward(t) < std::forward(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]); otherwise, T and U model totally_ordered_with.

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.

10

#

Effects:

If the expression std::forward(t) < std::forward(u) results in a call to a built-in operator < comparing pointers: returns true if (the converted value of) t precedes u in the implementation-defined strict total order over pointers ([defns.order.ptr]) and otherwise false.

Otherwise, equivalent to:return std::forward(t) < std::forward(u);

🔗

struct ranges::greater_equal {template<class T, class U>constexpr bool operator()(T&& t, U&& u) const; using is_transparent = unspecified;};

🔗

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

11

#

Constraints: T and U satisfy totally_ordered_with.

12

#

Effects: Equivalent to:return !ranges::less{}(std::forward(t), std::forward(u));

🔗

`struct ranges::less_equal { template<class T, class U> constexpr bool operator()(T&& t, U&& u) const;

using is_transparent = unspecified; }; `

🔗

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

13

#

Constraints: T and U satisfy totally_ordered_with.

14

#

Effects: Equivalent to:return !ranges::less{}(std::forward(u), std::forward(t));