|
|
Defined in header <compare> | ||
template<class T,class Cat=std::partial_ordering> concept three_way_comparable= | (1) | (since C++20) |
template<class T,class U,class Cat=std::partial_ordering> concept three_way_comparable_with= | (2) | (since C++20) |
template<class T,class Cat> concept __ComparesAs= | (3) | (exposition only*) |
std::three_way_comparable
specifies that the three way comparison operator<=>
onT
yield results consistent with the comparison category implied byCat
.std::three_way_comparable_with
specifies that the three way comparison operator<=>
on (possibly mixed)T
andU
operands yield results consistent with the comparison category implied byCat
. Comparing mixed operands yields results equivalent to comparing the operands converted to their common type.__WeaklyEqualityComparableWith,__PartiallyOrderedWith, and__ComparisonCommonTypeWith are exposition-only concepts. See descriptions ofequality_comparable
andtotally_ordered
.
Contents |
These concepts are modeled only if they are satisfied and all concepts they subsume are modeled.
T
andCat
modelstd::three_way_comparable<T, Cat> only if, given lvaluesa
andb
of typeconststd::remove_reference_t<T>, following are true:Cat
is convertible tostd::strong_ordering,T
modelstotally_ordered
.T
,U
, andCat
modelstd::three_way_comparable_with<T, U, Cat> only if givent
andt2
, lvalues denoting distinct equal objects of typesconststd::remove_reference_t<T> andstd::remove_reference_t<T> respectively, andu
andu2
, lvalues denoting distinct equal objects of typesconststd::remove_reference_t<U> andstd::remove_reference_t<U> respectively.LetC
bestd::common_reference_t<conststd::remove_reference_t<T>&,conststd::remove_reference_t<U>&> and given an expressionE
and a typeC
, letCONVERT_TO<C>(E) be:
| (until C++23) |
| (since C++23) |
the following are true:
Cat
is convertible tostd::strong_ordering,T
andU
modelstd::totally_ordered_with<T, U>.Expressions declared inrequires expressions of the standard library concepts are required to beequality-preserving (except where stated otherwise).
Arequires expression that uses an expression that is non-modifying for some constant lvalue operand also requiresimplicit expression variations.
specifies that operator== is an equivalence relation (concept)[edit] | |
specifies that the comparison operators on the type yield a total order (concept)[edit] |