std::weak_order
| Defined in header <compare> | ||
|---|---|---|
| template< class T > constexpr std::weak_ordering weak_order(const T& a, const T& b); | (since C++20) | 
Compares two values using 3-way comparison and produces a result of type std::weak_ordering.
Specifically,
-  If the expression a <=> bis well-formed and its result is convertible tostd::weak_ordering, returns that result.
-  Otherwise, if the expression a <=> bis well-formed, but its result is not convertible tostd::weak_ordering, then the function is defined as deleted.
-  Otherwise, if the expression a <=> bis ill-formed, but the expressionsa == banda < bare both well-formed and convertible tobool,
-  if a == bistrue, returnsstd::weak_ordering::equivalent
-  otherwise, if a < bistrue, returnsstd::weak_ordering::less
-  otherwise, returns std::weak_ordering::greater
- Otherwise, the function is defined as deleted.
Parameters
| a, b | - | values to compare | 
Return value
A value of type std::weak_ordering, as described above.
Notes
Example
See also
| (C++20) | the result type of 3-way comparison that supports all 6 operators and is not substitutable (class) | 
| (C++20) | performs 3-way comparison and produces a result of type std::strong_ordering (function template) | 
| (C++20) | performs 3-way comparison and produces a result of type std::partial_ordering (function template) | 
| (C++20) | performs 3-way comparison and produces a result of type std::weak_equality (function template) | 
    © cppreference.com
Licensed under the Creative Commons Attribution-ShareAlike Unported License v3.0.
    http://en.cppreference.com/w/cpp/utility/compare/weak_order