17 Language support library [support] (original) (raw)
The weak_ordering type is typically used as the result type of a three-way comparison operator ([expr.spaceship]) for a type that admits all of the six two-way comparison operators ([expr.rel], [expr.eq]) and for which equality need not imply substitutability.
namespace std { class weak_ordering { int value; constexpr explicit weak_ordering(ord v) noexcept : value(int(v)) {} public: static const weak_ordering less;static const weak_ordering equivalent;static const weak_ordering greater;constexpr operator partial_ordering() const noexcept;friend constexpr bool operator==(weak_ordering v, unspecified) noexcept;friend constexpr bool operator==(weak_ordering v, weak_ordering w) noexcept = default;friend constexpr bool operator< (weak_ordering v, _unspecified_) noexcept;friend constexpr bool operator> (weak_ordering v, unspecified) noexcept;friend constexpr bool operator<=(weak_ordering v, _unspecified_) noexcept;friend constexpr bool operator>=(weak_ordering v, unspecified) noexcept;friend constexpr bool operator< (_unspecified_, weak_ordering v) noexcept;friend constexpr bool operator> (unspecified, weak_ordering v) noexcept;friend constexpr bool operator<=(_unspecified_, weak_ordering v) noexcept;friend constexpr bool operator>=(unspecified, weak_ordering v) noexcept;friend constexpr weak_ordering operator<=>(weak_ordering v, unspecified) noexcept;friend constexpr weak_ordering operator<=>(unspecified, weak_ordering v) noexcept;};inline constexpr weak_ordering weak_ordering::less(ord::less);inline constexpr weak_ordering weak_ordering::equivalent(ord::equivalent);inline constexpr weak_ordering weak_ordering::greater(ord::greater);}
Returns: value == 0 ? partial_ordering::equivalent :value < 0 ? partial_ordering::less : partial_ordering::greater
Returns: v < 0 ? weak_ordering::greater : v > 0 ? weak_ordering::less : v.