std::type_order
Defined in header <compare> | ||
|---|---|---|
template< class T, class U > struct type_order; | (since C++26) |
Implements an implementation-defined total ordering of all types.
Provides the member constant value equal to std::strong_ordering::less if T precedes U in this implementation-defined total order, std::strong_ordering::greater if U precedes T, and std::strong_ordering::equal if they are the same type.
This ordering need not be consistent with the one induced by std::type_info::before.
The template arguments T and U can be incomplete types.
If the program adds specializations for std::type_order or std::type_order_v, the program is ill-formed.
Helper variable template
template< class T, class U > constexpr std::strong_ordering type_order_v = type_order<T, U>::value; | (since C++26) |
Member constants
|
value
[static] | a value of type std::strong_ordering, as described above (public static member constant) |
Member functions
|
operator std::strong_ordering | converts the object to std::strong_ordering, returns value (public member function) |
|
operator() | returns value (public member function) |
Member types
| Type | Definition |
|---|---|
value_type | std::strong_ordering |
Notes
| Feature-test macro | Value | Std | Feature |
|---|---|---|---|
__cpp_lib_type_order | 202506L | (C++26) |
std::type_order, std::type_order_v |
Example
See also
|
(C++20) | the result type of 3-way comparison that supports all 6 operators and is substitutable (class) |
© cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
https://en.cppreference.com/cpp/utility/compare/type_order