std::common_comparison_category - cppreference.com (original) (raw)
| | | | | --------------------------------------------------------------------------------------------------- | | ------------- | | template< class... Ts > struct common_comparison_category { using type = /* see below */ ; }; | | (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
is void. - Otherwise, if at least one
T
i is std::partial_ordering,U
is std::partial_ordering. - Otherwise, if at least one
T
i is std::weak_ordering,U
is std::weak_ordering. - Otherwise (if every
T
i is std::strong_ordering, or if the list is empty),U
is std::strong_ordering.
Contents
- 1 Template parameters
- 2 Helper template
- 3 Member types
- 4 Possible implementation
- 5 Example
- 6 See also
[edit] Template parameters
...Ts | - | a possibly empty list of types |
---|
[edit] Helper template
| template< class... Ts > using common_comparison_category_t = common_comparison_category<Ts...>::type; | | (since C++20) | | ------------------------------------------------------------------------------------------------------------- | | ------------- |
[edit] Member types
Member type | Definition |
---|---|
type | the strongest common comparison category (as defined above) |
[edit] Possible implementation
[edit] Example
[edit] See also
| | the result type of 3-way comparison that supports all 6 operators and is substitutable (class) [edit] | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | | the result type of 3-way comparison that supports all 6 operators and is not substitutable (class) [edit] | | | the result type of 3-way comparison that supports all 6 operators, is not substitutable, and allows incomparable values (class) [edit] |