On this page
std::common_comparison_category
Defined in header <compare> |
||
---|---|---|
|
(since C++20) |
The class template std::common_comparison_category
provides an alias (as the member typedef type
) for the strongest comparison category to which all of the template arguments Ts...
can be converted.
In detail, the common comparison type of a list of n types T
0...T
n-1 is defined as follows:
- If any
T
i is not a comparison category type (std::partial_ordering
,std::weak_ordering
,std::strong_ordering
),U
isvoid
. - Otherwise, if at least one
T
i isstd::partial_ordering
,U
isstd::partial_ordering
. - Otherwise, if at least one
T
i isstd::weak_ordering
,U
isstd::weak_ordering
. - Otherwise (if every
T
i isstd::strong_ordering
, or if the list is empty),U
isstd::strong_ordering
.
Template parameters
...Ts | - | a possibly empty list of types |
Helper template
|
(since C++20) |
Member types
Member type | Definition |
---|---|
type |
the strongest common comparison category (as defined above) |
Possible implementation
|
Example
See also
(C++20)
|
the result type of 3-way comparison that supports all 6 operators and is substitutable (class) |
(C++20)
|
the result type of 3-way comparison that supports all 6 operators and is not substitutable (class) |
(C++20)
|
the result type of 3-way comparison that supports all 6 operators, is not substitutable, and allows incomparable values (class) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/w/cpp/utility/compare/common_comparison_category