template< class T, class U = T >
struct compare_three_way_result;
Let t
and u
denote lvalue of const std::remove_reference_t<T> and const std::remove_reference_t<U> respectively, if the expression t <=> u is well-formed, provides the member typedef type
equal to decltype(t <=> u), otherwise there is no member type
.
If the program adds specializations for std::compare_three_way_result
, the behavior is undefined.
type
the result type of operator<=> on const-qualified lvalue of T
and U
[edit] Helper types
template< class T, class U = T >
using compare_three_way_result_t = compare_three_way_result<T, U>::type;
// recommended by Casey Carter // see also: https://github.com/microsoft/STL/pull/385#discussion_r357894054 template<class T, class U = T> using compare_three_way_result_t = decltype( std::declval<const std::remove_reference_t<T>&>() <=> std::declval<const std::remove_reference_t<U>&>() ); template<class T, class U = T> struct compare_three_way_result {}; template<class T, class U> requires requires { typename compare_three_way_result_t<T, U>; } struct compare_three_way_result<T, U> { using type = compare_three_way_result_t<T, U>; };[edit] Example
Output:
strong ordering partial ordering[edit] See also the result type of 3-way comparison that supports all 6 operators, is not substitutable, and allows incomparable values
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4