[cmp.partialord] (original) (raw)
The partial_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]), for which equality need not imply substitutability, and that permits two values to be incomparable.190
namespace std { class partial_ordering { int value; bool is_ordered; constexpr explicit partial_ordering(ord v) noexcept : value(int(v)), is_ordered(true) {} constexpr explicit partial_ordering(ncmp v) noexcept : value(int(v)), is_ordered(false) {} public: static const partial_ordering less;static const partial_ordering equivalent;static const partial_ordering greater;static const partial_ordering unordered;friend constexpr bool operator==(partial_ordering v, unspecified) noexcept;friend constexpr bool operator==(partial_ordering v, partial_ordering w) noexcept = default;friend constexpr bool operator< (partial_ordering v, _unspecified_) noexcept;friend constexpr bool operator> (partial_ordering v, unspecified) noexcept;friend constexpr bool operator<=(partial_ordering v, _unspecified_) noexcept;friend constexpr bool operator>=(partial_ordering v, unspecified) noexcept;friend constexpr bool operator< (_unspecified_, partial_ordering v) noexcept;friend constexpr bool operator> (unspecified, partial_ordering v) noexcept;friend constexpr bool operator<=(_unspecified_, partial_ordering v) noexcept;friend constexpr bool operator>=(unspecified, partial_ordering v) noexcept;friend constexpr partial_ordering operator<=>(partial_ordering v, unspecified) noexcept;friend constexpr partial_ordering operator<=>(unspecified, partial_ordering v) noexcept;};inline constexpr partial_ordering partial_ordering::less(ord::less);inline constexpr partial_ordering partial_ordering::equivalent(ord::equivalent);inline constexpr partial_ordering partial_ordering::greater(ord::greater);inline constexpr partial_ordering partial_ordering::unordered(ncmp::unordered);}
Returns: For operator@, v.is_ordered && v.value @ 0.
Returns: For operator@, v.is_ordered && 0 @ v.value.
Returns: v < 0 ? partial_ordering::greater : v > 0 ? partial_ordering::less : v.