|
|
|
Defined in header <concepts> | ||
template<class T> concept totally_ordered= | (1) | (since C++20) |
template<class T,class U> concept totally_ordered_with= | (2) | (since C++20) |
Helper concepts | ||
template<class T,class U> concept __PartiallyOrderedWith= | (3) | (exposition only*) |
std::totally_ordered
specifies that the comparison operators==,!=,<,>,<=,>=
on a type yield results consistent with astrict total order on the type.std::totally_ordered_with
specifies that the comparison operators==,!=,<,>,<=,>=
on (possibly mixed)T
andU
operands yield results consistent with a strict total order. Comparing mixed operands yields results equivalent to comparing the operands converted to their common type.__PartiallyOrderedWith
specifies that a value of typeT
and a value of typeU
can be compared in a partial order with each other (in either order) using<
,>
,<=
, and>=
, and the results of the comparisons are consistent.Contents |
These concepts are modeled only if they are satisfied and all concepts they subsume are modeled.
a
,b
andc
of typeconststd::remove_reference_t<T>:t
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:
t
of typeconststd::remove_reference_t<T>, andu
of typeconststd::remove_reference_t<U>,the following are true:
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.
totally_ordered
[concept.totallyordered] totally_ordered
[concept.totallyordered] specifies that operator<=> produces consistent result on given types (concept)[edit] |