17 Language support library [support] (original) (raw)

17.12 Comparisons [cmp]

17.12.4 Concept three_way_comparable [cmp.concept]

Let t and u be lvalues of types const remove_reference_t<T> andconst remove_reference_t<U>, respectively.

T and U modelpartially-ordered-with<T, U> only if

template<class T, class Cat = partial_ordering> concept three_way_comparable = weakly-equality-comparable-with<T, T> && partially-ordered-with<T, T> && requires(const remove_reference_t<T>& a, const remove_reference_t<T>& b) { { a <=> b } -> compares-as<Cat>;};

Let a and b be lvalues of type const remove_reference_t<T>.

T and Catmodel three_way_comparable<T, Cat> only if

template<class T, class U, class Cat = partial_ordering> concept three_way_comparable_with = three_way_comparable<T, Cat> && three_way_comparable<U, Cat> && comparison-common-type-with<T, U> && three_way_comparable< common_reference_t<const remove_reference_t<T>&, const remove_reference_t<U>&>, Cat> && weakly-equality-comparable-with<T, U> && partially-ordered-with<T, U> && requires(const remove_reference_t<T>& t, const remove_reference_t<U>& u) { { t <=> u } -> compares-as<Cat>;{ u <=> t } -> compares-as<Cat>;};

Let t and t2 be lvalues denoting distinct equal objects of types const remove_reference_t<T> andremove_cvref_t<T>, respectively, and let u and u2 be lvalues denoting distinct equal objects of types const remove_reference_t<U> andremove_cvref_t<U>, respectively.

Let C becommon_reference_t<const remove_reference_t<T>&, const remove_reference_t<U>&>.

T, U, and Catmodel three_way_comparable_with<T, U, Cat> only if