std::strong_ordering
has comparison operators for which one parameter is of unspecified type. It's not clear how they factor in overload resolution, although it is quite probable that they are intentionally the least viable function.
Comparison operators are defined between values of this type and literal 0
. This supports the expressions a <=> b == 0
or a <=> b < 0
that can be used to convert the result of a three-way comparison operator to a boolean relationship; see std::is_eq
, std::is_lt
, etc.
These functions are not visible to ordinary unqualified or qualified lookup, and can only be found by argument-dependent lookup when std::strong_ordering
is an associated class of the arguments.
The behavior of a program that attempts to compare a strong_ordering with anything other than the integer literal 0
is undefined.
Your comparison template is wildly too general. It is implying that anything is >
comparable to anything else. Either remove it, or add a requires clause.
template <typename L, typename R>
requires requires (const L& l, const R& r) { r < l; }
bool operator > (const L& l, const R& r) { return r < l; }