cpp/utility/compare/strong 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 four valid values, implemented as const static data members of its type:

Conversions
is the strongest of the three comparison categories: it is not implicitly-convertible from any other category and is implicitly-convertible to the other two.

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

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

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

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

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|1=operator==|2= {{dcl begin}} {{dcl|num=1|1= friend constexpr bool operator==( strong_ordering v, /* unspecified */ u ) noexcept; }} {{dcl|num=2|1= friend constexpr bool operator==( strong_ordering v, strong_ordering w ) noexcept = default; }} {{dcl end}}

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

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

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

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

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

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

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

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

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

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

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