diff --git a/libcxx/include/compare b/libcxx/include/compare --- a/libcxx/include/compare +++ b/libcxx/include/compare @@ -127,8 +127,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if _LIBCPP_STD_VER > 17 - +#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR) // exposition only enum class _LIBCPP_ENUM_VIS _EqResult : unsigned char { __zero = 0, @@ -182,24 +181,19 @@ // comparisons _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator==(partial_ordering __v, _CmpUnspecifiedParam) noexcept; - _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator!=(partial_ordering __v, _CmpUnspecifiedParam) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator< (partial_ordering __v, _CmpUnspecifiedParam) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator<=(partial_ordering __v, _CmpUnspecifiedParam) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator> (partial_ordering __v, _CmpUnspecifiedParam) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator>=(partial_ordering __v, _CmpUnspecifiedParam) noexcept; - _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator==(_CmpUnspecifiedParam, partial_ordering __v) noexcept; - _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator!=(_CmpUnspecifiedParam, partial_ordering __v) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator< (_CmpUnspecifiedParam, partial_ordering __v) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator<=(_CmpUnspecifiedParam, partial_ordering __v) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator> (_CmpUnspecifiedParam, partial_ordering __v) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator>=(_CmpUnspecifiedParam, partial_ordering __v) noexcept; -#ifndef _LIBCPP_HAS_NO_SPACESHIP_OPERATOR _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator==(partial_ordering, partial_ordering) noexcept = default; _LIBCPP_INLINE_VISIBILITY friend constexpr partial_ordering operator<=>(partial_ordering __v, _CmpUnspecifiedParam) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr partial_ordering operator<=>(_CmpUnspecifiedParam, partial_ordering __v) noexcept; -#endif private: _ValueT __value_; @@ -231,10 +225,6 @@ return __v.__is_ordered() && __v.__value_ >= 0; } -_LIBCPP_INLINE_VISIBILITY -constexpr bool operator==(_CmpUnspecifiedParam, partial_ordering __v) noexcept { - return __v.__is_ordered() && 0 == __v.__value_; -} _LIBCPP_INLINE_VISIBILITY constexpr bool operator< (_CmpUnspecifiedParam, partial_ordering __v) noexcept { return __v.__is_ordered() && 0 < __v.__value_; @@ -252,16 +242,6 @@ return __v.__is_ordered() && 0 >= __v.__value_; } -_LIBCPP_INLINE_VISIBILITY -constexpr bool operator!=(partial_ordering __v, _CmpUnspecifiedParam) noexcept { - return !__v.__is_ordered() || __v.__value_ != 0; -} -_LIBCPP_INLINE_VISIBILITY -constexpr bool operator!=(_CmpUnspecifiedParam, partial_ordering __v) noexcept { - return !__v.__is_ordered() || __v.__value_ != 0; -} - -#ifndef _LIBCPP_HAS_NO_SPACESHIP_OPERATOR _LIBCPP_INLINE_VISIBILITY constexpr partial_ordering operator<=>(partial_ordering __v, _CmpUnspecifiedParam) noexcept { return __v; @@ -270,7 +250,6 @@ constexpr partial_ordering operator<=>(_CmpUnspecifiedParam, partial_ordering __v) noexcept { return __v < 0 ? partial_ordering::greater : (__v > 0 ? partial_ordering::less : __v); } -#endif // _LIBCPP_HAS_NO_SPACESHIP_OPERATOR class weak_ordering { using _ValueT = signed char; @@ -293,24 +272,19 @@ // comparisons _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator==(weak_ordering __v, _CmpUnspecifiedParam) noexcept; - _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator!=(weak_ordering __v, _CmpUnspecifiedParam) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator< (weak_ordering __v, _CmpUnspecifiedParam) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator<=(weak_ordering __v, _CmpUnspecifiedParam) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator> (weak_ordering __v, _CmpUnspecifiedParam) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator>=(weak_ordering __v, _CmpUnspecifiedParam) noexcept; - _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator==(_CmpUnspecifiedParam, weak_ordering __v) noexcept; - _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator!=(_CmpUnspecifiedParam, weak_ordering __v) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator< (_CmpUnspecifiedParam, weak_ordering __v) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator<=(_CmpUnspecifiedParam, weak_ordering __v) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator> (_CmpUnspecifiedParam, weak_ordering __v) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator>=(_CmpUnspecifiedParam, weak_ordering __v) noexcept; -#ifndef _LIBCPP_HAS_NO_SPACESHIP_OPERATOR _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator==(weak_ordering, weak_ordering) noexcept = default; _LIBCPP_INLINE_VISIBILITY friend constexpr weak_ordering operator<=>(weak_ordering __v, _CmpUnspecifiedParam) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr weak_ordering operator<=>(_CmpUnspecifiedParam, weak_ordering __v) noexcept; -#endif private: _ValueT __value_; @@ -325,10 +299,6 @@ return __v.__value_ == 0; } _LIBCPP_INLINE_VISIBILITY -constexpr bool operator!=(weak_ordering __v, _CmpUnspecifiedParam) noexcept { - return __v.__value_ != 0; -} -_LIBCPP_INLINE_VISIBILITY constexpr bool operator< (weak_ordering __v, _CmpUnspecifiedParam) noexcept { return __v.__value_ < 0; } @@ -345,14 +315,6 @@ return __v.__value_ >= 0; } _LIBCPP_INLINE_VISIBILITY -constexpr bool operator==(_CmpUnspecifiedParam, weak_ordering __v) noexcept { - return 0 == __v.__value_; -} -_LIBCPP_INLINE_VISIBILITY -constexpr bool operator!=(_CmpUnspecifiedParam, weak_ordering __v) noexcept { - return 0 != __v.__value_; -} -_LIBCPP_INLINE_VISIBILITY constexpr bool operator< (_CmpUnspecifiedParam, weak_ordering __v) noexcept { return 0 < __v.__value_; } @@ -369,7 +331,6 @@ return 0 >= __v.__value_; } -#ifndef _LIBCPP_HAS_NO_SPACESHIP_OPERATOR _LIBCPP_INLINE_VISIBILITY constexpr weak_ordering operator<=>(weak_ordering __v, _CmpUnspecifiedParam) noexcept { return __v; @@ -378,8 +339,6 @@ constexpr weak_ordering operator<=>(_CmpUnspecifiedParam, weak_ordering __v) noexcept { return __v < 0 ? weak_ordering::greater : (__v > 0 ? weak_ordering::less : __v); } -#endif // _LIBCPP_HAS_NO_SPACESHIP_OPERATOR - class strong_ordering { using _ValueT = signed char; @@ -408,24 +367,19 @@ // comparisons _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator==(strong_ordering __v, _CmpUnspecifiedParam) noexcept; - _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator!=(strong_ordering __v, _CmpUnspecifiedParam) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator< (strong_ordering __v, _CmpUnspecifiedParam) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator<=(strong_ordering __v, _CmpUnspecifiedParam) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator> (strong_ordering __v, _CmpUnspecifiedParam) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator>=(strong_ordering __v, _CmpUnspecifiedParam) noexcept; - _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator==(_CmpUnspecifiedParam, strong_ordering __v) noexcept; - _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator!=(_CmpUnspecifiedParam, strong_ordering __v) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator< (_CmpUnspecifiedParam, strong_ordering __v) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator<=(_CmpUnspecifiedParam, strong_ordering __v) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator> (_CmpUnspecifiedParam, strong_ordering __v) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator>=(_CmpUnspecifiedParam, strong_ordering __v) noexcept; -#ifndef _LIBCPP_HAS_NO_SPACESHIP_OPERATOR _LIBCPP_INLINE_VISIBILITY friend constexpr bool operator==(strong_ordering, strong_ordering) noexcept = default; _LIBCPP_INLINE_VISIBILITY friend constexpr strong_ordering operator<=>(strong_ordering __v, _CmpUnspecifiedParam) noexcept; _LIBCPP_INLINE_VISIBILITY friend constexpr strong_ordering operator<=>(_CmpUnspecifiedParam, strong_ordering __v) noexcept; -#endif private: _ValueT __value_; @@ -441,10 +395,6 @@ return __v.__value_ == 0; } _LIBCPP_INLINE_VISIBILITY -constexpr bool operator!=(strong_ordering __v, _CmpUnspecifiedParam) noexcept { - return __v.__value_ != 0; -} -_LIBCPP_INLINE_VISIBILITY constexpr bool operator< (strong_ordering __v, _CmpUnspecifiedParam) noexcept { return __v.__value_ < 0; } @@ -461,14 +411,6 @@ return __v.__value_ >= 0; } _LIBCPP_INLINE_VISIBILITY -constexpr bool operator==(_CmpUnspecifiedParam, strong_ordering __v) noexcept { - return 0 == __v.__value_; -} -_LIBCPP_INLINE_VISIBILITY -constexpr bool operator!=(_CmpUnspecifiedParam, strong_ordering __v) noexcept { - return 0 != __v.__value_; -} -_LIBCPP_INLINE_VISIBILITY constexpr bool operator< (_CmpUnspecifiedParam, strong_ordering __v) noexcept { return 0 < __v.__value_; } @@ -485,7 +427,6 @@ return 0 >= __v.__value_; } -#ifndef _LIBCPP_HAS_NO_SPACESHIP_OPERATOR _LIBCPP_INLINE_VISIBILITY constexpr strong_ordering operator<=>(strong_ordering __v, _CmpUnspecifiedParam) noexcept { return __v; @@ -494,7 +435,6 @@ constexpr strong_ordering operator<=>(_CmpUnspecifiedParam, strong_ordering __v) noexcept { return __v < 0 ? strong_ordering::greater : (__v > 0 ? strong_ordering::less : __v); } -#endif // _LIBCPP_HAS_NO_SPACESHIP_OPERATOR // named comparison functions _LIBCPP_INLINE_VISIBILITY @@ -583,7 +523,7 @@ template constexpr weak_ordering weak_order(const _Tp& __lhs, const _Tp& __rhs); template constexpr partial_ordering partial_order(const _Tp& __lhs, const _Tp& __rhs); -#endif // _LIBCPP_STD_VER > 17 +#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_SPACESHIP_OPERATOR) _LIBCPP_END_NAMESPACE_STD