std::compare_three_way_result
Min standard notice:
Header: <compare>
Let t and u denote lvalue of const std::remove_reference_t
# Declarations
template< class T, class U = T >
struct compare_three_way_result;
(since C++20)
# Example
#include <compare>
#include <iostream>
#include <type_traits>
template<class Ord>
void print_cmp_type()
{
if constexpr (std::is_same_v<Ord, std::strong_ordering>)
std::cout << "strong ordering\n";
else if constexpr (std::is_same_v<Ord, std::weak_ordering>)
std::cout << "weak ordering\n";
else if constexpr (std::is_same_v<Ord, std::partial_ordering>)
std::cout << "partial ordering\n";
else
std::cout << "illegal comparison result type\n";
}
int main()
{
print_cmp_type<std::compare_three_way_result_t<int>>();
print_cmp_type<std::compare_three_way_result_t<double>>();
}