cpp/utility/compare/weak ordering

The class type is the result type of a three-way comparison that
 * admits all six relational operators


 * : exactly one of, , or must be.

Constants
The type has three valid values, implemented as const static data members of its type:

Conversions
is implicitly-convertible to std, while std is implicitly-convertible to weak_ordering.

{{member|{{small|std::weak_ordering::}}operator partial_ordering|2= {{ddcl|1= constexpr operator partial_ordering const noexcept; }}

Return value
std if is, std if  is , std if is. }}

Comparisons
Comparison operators are defined between values of this type and literal. This supports the expressions or  that can be used to convert the result of a three-way comparison operator to a boolean relationship; see , , etc.

The behavior of a program that attempts to compare a with anything other than the integer literal  is undefined.

{{member|operator{{==}}|2= {{dcl begin}} {{dcl|num=1|1= friend constexpr bool operator==( weak_ordering v, /*unspecified*/ u ) noexcept; }} {{dcl|num=2|1= friend constexpr bool operator==( weak_ordering v, weak_ordering w ) noexcept = default; }} {{dcl end}}

Return value
@1@ if  is,  if  is  or @2@  if both parameters hold the same value,  otherwise }}

{{member|operator&lt;|2= {{dcl begin}} {{dcl|num=1|1= friend constexpr bool operator<( weak_ordering v, /*unspecified*/ u ) noexcept; }} {{dcl|num=2|1= friend constexpr bool operator<( /*unspecified*/ u, weak_ordering v ) noexcept; }} {{dcl end}}

Return value
@1@ if  is, and  if  is  or @2@  if  is , and  if  is  or }}

{{member|operator&lt;{{=}}|2= {{dcl begin}} {{dcl|num=1|1= friend constexpr bool operator<=( weak_ordering v, /*unspecified*/ u ) noexcept; }} {{dcl|num=2|1= friend constexpr bool operator<=( /*unspecified*/ u, weak_ordering v ) noexcept; }} {{dcl end}}

Return value
@1@ if  is  or, and  if  is @2@  if  is  or , and  if  is }}

{{member|operator&gt;|2= {{dcl begin}} {{dcl|num=1|1= friend constexpr bool operator>( weak_ordering v, /*unspecified*/ u ) noexcept; }} {{dcl|num=2|1= friend constexpr bool operator>( /*unspecified*/ u, weak_ordering v ) noexcept; }} {{dcl end}}

Return value
@1@ if  is, and  if  is  or @2@  if  is , and  if  is  or }}

{{member|operator&gt;{{=}}|2= {{dcl begin}} {{dcl|num=1|1= friend constexpr bool operator>=( weak_ordering v, /*unspecified*/ u ) noexcept; }} {{dcl|num=2|1= friend constexpr bool operator>=( /*unspecified*/ u, weak_ordering v ) noexcept; }} {{dcl end}}

Return value
@1@ if  is  or, and  if  is @2@  if  is  or , and  if  is }} {{member|operator<{{=}}>|2= {{dcl begin}} {{dcl|num=1|1= friend constexpr weak_ordering operator<=>( weak_ordering v, /*unspecified*/ u ) noexcept; }} {{dcl|num=2|1= friend constexpr weak_ordering operator<=>( /*unspecified*/ u, weak_ordering v ) noexcept; }} {{dcl end}}

Return value
@1@ . @2@ if  is,  if  is , otherwise. }}