Files
2025-10-25 03:02:53 +03:00

2.2 KiB
Raw Permalink Blame History

[comparisons.three.way]

22 General utilities library [utilities]

22.10 Function objects [function.objects]

22.10.8 Comparisons [comparisons]

22.10.8.8 Class compare_three_way [comparisons.three.way]

🔗

namespace std {struct compare_three_way {template<class T, class U>constexpr auto operator()(T&& t, U&& u) const; using is_transparent = unspecified; };}

🔗

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

1

#

Constraints: T and U satisfy three_way_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 type P, the conversion sequences from both T and U to P are equality-preserving ([concepts.equality]); otherwise, T and U model three_way_comparable_with.

3

#

Effects:

If the expression std::forward(t) <=> std::forward(u) results in a call to a built-in operator <=> comparing pointers of type P, returns strong_ordering::less if (the converted value of) t precedes u in the implementation-defined strict total order over pointers ([defns.order.ptr]), strong_ordering::greater if u precedes t, and otherwise strong_ordering::equal.

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