diff options
Diffstat (limited to 'third_party/libcxx/include/c++/v1/__compare')
13 files changed, 0 insertions, 1123 deletions
diff --git a/third_party/libcxx/include/c++/v1/__compare/common_comparison_category.h b/third_party/libcxx/include/c++/v1/__compare/common_comparison_category.h deleted file mode 100644 index eae2ef0..0000000 --- a/third_party/libcxx/include/c++/v1/__compare/common_comparison_category.h +++ /dev/null @@ -1,86 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___COMPARE_COMMON_COMPARISON_CATEGORY_H -#define _LIBCPP___COMPARE_COMMON_COMPARISON_CATEGORY_H - -#include <__compare/ordering.h> -#include <__config> -#include <__cstddef/size_t.h> -#include <__type_traits/is_same.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 20 - -namespace __comp_detail { - -enum _ClassifyCompCategory : unsigned { _None, _PartialOrd, _WeakOrd, _StrongOrd, _CCC_Size }; - -template <class _Tp> -_LIBCPP_HIDE_FROM_ABI constexpr _ClassifyCompCategory __type_to_enum() noexcept { - if (is_same_v<_Tp, partial_ordering>) - return _PartialOrd; - if (is_same_v<_Tp, weak_ordering>) - return _WeakOrd; - if (is_same_v<_Tp, strong_ordering>) - return _StrongOrd; - return _None; -} - -template <size_t _Size> -_LIBCPP_HIDE_FROM_ABI constexpr _ClassifyCompCategory -__compute_comp_type(const _ClassifyCompCategory (&__types)[_Size]) { - int __seen[_CCC_Size] = {}; - for (auto __type : __types) - ++__seen[__type]; - if (__seen[_None]) - return _None; - if (__seen[_PartialOrd]) - return _PartialOrd; - if (__seen[_WeakOrd]) - return _WeakOrd; - return _StrongOrd; -} - -template <class... _Ts, bool _False = false> -_LIBCPP_HIDE_FROM_ABI constexpr auto __get_comp_type() { - using _CCC = _ClassifyCompCategory; - constexpr _CCC __type_kinds[] = {_StrongOrd, __comp_detail::__type_to_enum<_Ts>()...}; - constexpr _CCC __cat = __comp_detail::__compute_comp_type(__type_kinds); - if constexpr (__cat == _None) - return void(); - else if constexpr (__cat == _PartialOrd) - return partial_ordering::equivalent; - else if constexpr (__cat == _WeakOrd) - return weak_ordering::equivalent; - else if constexpr (__cat == _StrongOrd) - return strong_ordering::equivalent; - else - static_assert(_False, "unhandled case"); -} -} // namespace __comp_detail - -// [cmp.common], common comparison category type -template <class... _Ts> -struct common_comparison_category { - using type _LIBCPP_NODEBUG = decltype(__comp_detail::__get_comp_type<_Ts...>()); -}; - -template <class... _Ts> -using common_comparison_category_t = typename common_comparison_category<_Ts...>::type; - -#endif // _LIBCPP_STD_VER >= 20 - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___COMPARE_COMMON_COMPARISON_CATEGORY_H diff --git a/third_party/libcxx/include/c++/v1/__compare/compare_partial_order_fallback.h b/third_party/libcxx/include/c++/v1/__compare/compare_partial_order_fallback.h deleted file mode 100644 index 80f2aca..0000000 --- a/third_party/libcxx/include/c++/v1/__compare/compare_partial_order_fallback.h +++ /dev/null @@ -1,75 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___COMPARE_COMPARE_PARTIAL_ORDER_FALLBACK -#define _LIBCPP___COMPARE_COMPARE_PARTIAL_ORDER_FALLBACK - -#include <__compare/ordering.h> -#include <__compare/partial_order.h> -#include <__concepts/boolean_testable.h> -#include <__config> -#include <__type_traits/decay.h> -#include <__type_traits/is_same.h> -#include <__utility/forward.h> -#include <__utility/priority_tag.h> - -#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 20 - -// [cmp.alg] -namespace __compare_partial_order_fallback { -struct __fn { - template <class _Tp, class _Up> - requires is_same_v<decay_t<_Tp>, decay_t<_Up>> - _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept( - noexcept(std::partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) - -> decltype(std::partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))) { - return std::partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)); - } - - template <class _Tp, class _Up> - requires is_same_v<decay_t<_Tp>, decay_t<_Up>> && requires(_Tp&& __t, _Up&& __u) { - { std::forward<_Tp>(__t) == std::forward<_Up>(__u) } -> __boolean_testable; - { std::forward<_Tp>(__t) < std::forward<_Up>(__u) } -> __boolean_testable; - { std::forward<_Up>(__u) < std::forward<_Tp>(__t) } -> __boolean_testable; - } - _LIBCPP_HIDE_FROM_ABI static constexpr partial_ordering __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept( - noexcept(std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? partial_ordering::equivalent - : std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? partial_ordering::less - : std::forward<_Up>(__u) < std::forward<_Tp>(__t) ? partial_ordering::greater - : partial_ordering::unordered)) { - return std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? partial_ordering::equivalent - : std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? partial_ordering::less - : std::forward<_Up>(__u) < std::forward<_Tp>(__t) - ? partial_ordering::greater - : partial_ordering::unordered; - } - - template <class _Tp, class _Up> - _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const - noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>()))) - -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())) { - return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>()); - } -}; -} // namespace __compare_partial_order_fallback - -inline namespace __cpo { -inline constexpr auto compare_partial_order_fallback = __compare_partial_order_fallback::__fn{}; -} // namespace __cpo - -#endif // _LIBCPP_STD_VER >= 20 - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___COMPARE_COMPARE_PARTIAL_ORDER_FALLBACK diff --git a/third_party/libcxx/include/c++/v1/__compare/compare_strong_order_fallback.h b/third_party/libcxx/include/c++/v1/__compare/compare_strong_order_fallback.h deleted file mode 100644 index c41a90c..0000000 --- a/third_party/libcxx/include/c++/v1/__compare/compare_strong_order_fallback.h +++ /dev/null @@ -1,72 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___COMPARE_COMPARE_STRONG_ORDER_FALLBACK -#define _LIBCPP___COMPARE_COMPARE_STRONG_ORDER_FALLBACK - -#include <__compare/ordering.h> -#include <__compare/strong_order.h> -#include <__concepts/boolean_testable.h> -#include <__config> -#include <__type_traits/decay.h> -#include <__type_traits/is_same.h> -#include <__utility/forward.h> -#include <__utility/priority_tag.h> - -#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 20 - -// [cmp.alg] -namespace __compare_strong_order_fallback { -struct __fn { - template <class _Tp, class _Up> - requires is_same_v<decay_t<_Tp>, decay_t<_Up>> - _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept( - noexcept(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) - -> decltype(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))) { - return std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)); - } - - template <class _Tp, class _Up> - requires is_same_v<decay_t<_Tp>, decay_t<_Up>> && requires(_Tp&& __t, _Up&& __u) { - { std::forward<_Tp>(__t) == std::forward<_Up>(__u) } -> __boolean_testable; - { std::forward<_Tp>(__t) < std::forward<_Up>(__u) } -> __boolean_testable; - } - _LIBCPP_HIDE_FROM_ABI static constexpr strong_ordering __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept( - noexcept(std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? strong_ordering::equal - : std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? strong_ordering::less - : strong_ordering::greater)) { - return std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? strong_ordering::equal - : std::forward<_Tp>(__t) < std::forward<_Up>(__u) - ? strong_ordering::less - : strong_ordering::greater; - } - - template <class _Tp, class _Up> - _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const - noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>()))) - -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())) { - return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>()); - } -}; -} // namespace __compare_strong_order_fallback - -inline namespace __cpo { -inline constexpr auto compare_strong_order_fallback = __compare_strong_order_fallback::__fn{}; -} // namespace __cpo - -#endif // _LIBCPP_STD_VER >= 20 - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___COMPARE_COMPARE_STRONG_ORDER_FALLBACK diff --git a/third_party/libcxx/include/c++/v1/__compare/compare_three_way.h b/third_party/libcxx/include/c++/v1/__compare/compare_three_way.h deleted file mode 100644 index 852c587..0000000 --- a/third_party/libcxx/include/c++/v1/__compare/compare_three_way.h +++ /dev/null @@ -1,40 +0,0 @@ -// -*- C++ -*- -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___COMPARE_COMPARE_THREE_WAY_H -#define _LIBCPP___COMPARE_COMPARE_THREE_WAY_H - -#include <__compare/three_way_comparable.h> -#include <__config> -#include <__utility/forward.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 20 - -struct compare_three_way { - template <class _T1, class _T2> - requires three_way_comparable_with<_T1, _T2> - constexpr _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const - noexcept(noexcept(std::forward<_T1>(__t) <=> std::forward<_T2>(__u))) { - return std::forward<_T1>(__t) <=> std::forward<_T2>(__u); - } - - using is_transparent = void; -}; - -#endif // _LIBCPP_STD_VER >= 20 - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___COMPARE_COMPARE_THREE_WAY_H diff --git a/third_party/libcxx/include/c++/v1/__compare/compare_three_way_result.h b/third_party/libcxx/include/c++/v1/__compare/compare_three_way_result.h deleted file mode 100644 index 264a4d6..0000000 --- a/third_party/libcxx/include/c++/v1/__compare/compare_three_way_result.h +++ /dev/null @@ -1,46 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___COMPARE_COMPARE_THREE_WAY_RESULT_H -#define _LIBCPP___COMPARE_COMPARE_THREE_WAY_RESULT_H - -#include <__config> -#include <__type_traits/make_const_lvalue_ref.h> -#include <__utility/declval.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 20 - -template <class, class, class> -struct _LIBCPP_HIDE_FROM_ABI __compare_three_way_result {}; - -template <class _Tp, class _Up> -struct _LIBCPP_HIDE_FROM_ABI __compare_three_way_result< - _Tp, - _Up, - decltype(std::declval<__make_const_lvalue_ref<_Tp>>() <=> std::declval<__make_const_lvalue_ref<_Up>>(), void())> { - using type _LIBCPP_NODEBUG = - decltype(std::declval<__make_const_lvalue_ref<_Tp>>() <=> std::declval<__make_const_lvalue_ref<_Up>>()); -}; - -template <class _Tp, class _Up = _Tp> -struct _LIBCPP_NO_SPECIALIZATIONS compare_three_way_result : __compare_three_way_result<_Tp, _Up, void> {}; - -template <class _Tp, class _Up = _Tp> -using compare_three_way_result_t = typename compare_three_way_result<_Tp, _Up>::type; - -#endif // _LIBCPP_STD_VER >= 20 - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___COMPARE_COMPARE_THREE_WAY_RESULT_H diff --git a/third_party/libcxx/include/c++/v1/__compare/compare_weak_order_fallback.h b/third_party/libcxx/include/c++/v1/__compare/compare_weak_order_fallback.h deleted file mode 100644 index 26689fb..0000000 --- a/third_party/libcxx/include/c++/v1/__compare/compare_weak_order_fallback.h +++ /dev/null @@ -1,73 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___COMPARE_COMPARE_WEAK_ORDER_FALLBACK -#define _LIBCPP___COMPARE_COMPARE_WEAK_ORDER_FALLBACK - -#include <__compare/ordering.h> -#include <__compare/weak_order.h> -#include <__concepts/boolean_testable.h> -#include <__config> -#include <__type_traits/decay.h> -#include <__type_traits/is_same.h> -#include <__utility/forward.h> -#include <__utility/priority_tag.h> - -#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 20 - -// [cmp.alg] -namespace __compare_weak_order_fallback { -struct __fn { - template <class _Tp, class _Up> - requires is_same_v<decay_t<_Tp>, decay_t<_Up>> - _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept( - noexcept(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) - -> decltype(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))) { - return std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)); - } - - template <class _Tp, class _Up> - requires is_same_v<decay_t<_Tp>, decay_t<_Up>> && requires(_Tp&& __t, _Up&& __u) { - { std::forward<_Tp>(__t) == std::forward<_Up>(__u) } -> __boolean_testable; - { std::forward<_Tp>(__t) < std::forward<_Up>(__u) } -> __boolean_testable; - } - _LIBCPP_HIDE_FROM_ABI static constexpr weak_ordering __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept(noexcept( - std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? weak_ordering::equivalent - : std::forward<_Tp>(__t) < std::forward<_Up>(__u) - ? weak_ordering::less - : weak_ordering::greater)) { - return std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? weak_ordering::equivalent - : std::forward<_Tp>(__t) < std::forward<_Up>(__u) - ? weak_ordering::less - : weak_ordering::greater; - } - - template <class _Tp, class _Up> - _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const - noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>()))) - -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())) { - return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>()); - } -}; -} // namespace __compare_weak_order_fallback - -inline namespace __cpo { -inline constexpr auto compare_weak_order_fallback = __compare_weak_order_fallback::__fn{}; -} // namespace __cpo - -#endif // _LIBCPP_STD_VER >= 20 - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___COMPARE_COMPARE_WEAK_ORDER_FALLBACK diff --git a/third_party/libcxx/include/c++/v1/__compare/is_eq.h b/third_party/libcxx/include/c++/v1/__compare/is_eq.h deleted file mode 100644 index ee4d11b..0000000 --- a/third_party/libcxx/include/c++/v1/__compare/is_eq.h +++ /dev/null @@ -1,34 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___COMPARE_IS_EQ_H -#define _LIBCPP___COMPARE_IS_EQ_H - -#include <__compare/ordering.h> -#include <__config> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 20 - -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_eq(partial_ordering __c) noexcept { return __c == 0; } -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_neq(partial_ordering __c) noexcept { return __c != 0; } -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_lt(partial_ordering __c) noexcept { return __c < 0; } -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_lteq(partial_ordering __c) noexcept { return __c <= 0; } -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_gt(partial_ordering __c) noexcept { return __c > 0; } -[[nodiscard]] _LIBCPP_HIDE_FROM_ABI inline constexpr bool is_gteq(partial_ordering __c) noexcept { return __c >= 0; } - -#endif // _LIBCPP_STD_VER >= 20 - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___COMPARE_IS_EQ_H diff --git a/third_party/libcxx/include/c++/v1/__compare/ordering.h b/third_party/libcxx/include/c++/v1/__compare/ordering.h deleted file mode 100644 index 902ef53..0000000 --- a/third_party/libcxx/include/c++/v1/__compare/ordering.h +++ /dev/null @@ -1,282 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___COMPARE_ORDERING_H -#define _LIBCPP___COMPARE_ORDERING_H - -#include <__config> -#include <__type_traits/enable_if.h> -#include <__type_traits/is_same.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 20 - -// exposition only -enum class _OrdResult : signed char { __less = -1, __equiv = 0, __greater = 1 }; - -enum class _PartialOrdResult : signed char { - __less = static_cast<signed char>(_OrdResult::__less), - __equiv = static_cast<signed char>(_OrdResult::__equiv), - __greater = static_cast<signed char>(_OrdResult::__greater), - __unordered = -127, -}; - -class partial_ordering; -class weak_ordering; -class strong_ordering; - -struct _CmpUnspecifiedParam { - // If anything other than a literal 0 is provided, the behavior is undefined by the Standard. - // - // The alternative to the `__enable_if__` attribute would be to use the fact that a pointer - // can be constructed from literal 0, but this conflicts with `-Wzero-as-null-pointer-constant`. - template <class _Tp, class = __enable_if_t<is_same_v<_Tp, int> > > - _LIBCPP_HIDE_FROM_ABI consteval _CmpUnspecifiedParam(_Tp __zero) noexcept -# if __has_attribute(__enable_if__) - __attribute__((__enable_if__( - __zero == 0, "Only literal 0 is allowed as the operand of a comparison with one of the ordering types"))) -# endif - { - (void)__zero; - } -}; - -class partial_ordering { - _LIBCPP_HIDE_FROM_ABI explicit constexpr partial_ordering(_PartialOrdResult __v) noexcept : __value_(__v) {} - -public: - // valid values - static const partial_ordering less; - static const partial_ordering equivalent; - static const partial_ordering greater; - static const partial_ordering unordered; - - // comparisons - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(partial_ordering, partial_ordering) noexcept = default; - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(partial_ordering __v, _CmpUnspecifiedParam) noexcept { - return __v.__value_ == _PartialOrdResult::__equiv; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(partial_ordering __v, _CmpUnspecifiedParam) noexcept { - return __v.__value_ == _PartialOrdResult::__less; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(partial_ordering __v, _CmpUnspecifiedParam) noexcept { - return __v.__value_ == _PartialOrdResult::__equiv || __v.__value_ == _PartialOrdResult::__less; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(partial_ordering __v, _CmpUnspecifiedParam) noexcept { - return __v.__value_ == _PartialOrdResult::__greater; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(partial_ordering __v, _CmpUnspecifiedParam) noexcept { - return __v.__value_ == _PartialOrdResult::__equiv || __v.__value_ == _PartialOrdResult::__greater; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(_CmpUnspecifiedParam, partial_ordering __v) noexcept { - return __v.__value_ == _PartialOrdResult::__greater; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(_CmpUnspecifiedParam, partial_ordering __v) noexcept { - return __v.__value_ == _PartialOrdResult::__equiv || __v.__value_ == _PartialOrdResult::__greater; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(_CmpUnspecifiedParam, partial_ordering __v) noexcept { - return __v.__value_ == _PartialOrdResult::__less; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(_CmpUnspecifiedParam, partial_ordering __v) noexcept { - return __v.__value_ == _PartialOrdResult::__equiv || __v.__value_ == _PartialOrdResult::__less; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr partial_ordering - operator<=>(partial_ordering __v, _CmpUnspecifiedParam) noexcept { - return __v; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr partial_ordering - operator<=>(_CmpUnspecifiedParam, partial_ordering __v) noexcept { - return __v < 0 ? partial_ordering::greater : (__v > 0 ? partial_ordering::less : __v); - } - -private: - _PartialOrdResult __value_; -}; - -inline constexpr partial_ordering partial_ordering::less(_PartialOrdResult::__less); -inline constexpr partial_ordering partial_ordering::equivalent(_PartialOrdResult::__equiv); -inline constexpr partial_ordering partial_ordering::greater(_PartialOrdResult::__greater); -inline constexpr partial_ordering partial_ordering::unordered(_PartialOrdResult::__unordered); - -class weak_ordering { - using _ValueT _LIBCPP_NODEBUG = signed char; - - _LIBCPP_HIDE_FROM_ABI explicit constexpr weak_ordering(_OrdResult __v) noexcept : __value_(_ValueT(__v)) {} - -public: - static const weak_ordering less; - static const weak_ordering equivalent; - static const weak_ordering greater; - - _LIBCPP_HIDE_FROM_ABI constexpr operator partial_ordering() const noexcept { - return __value_ == 0 ? partial_ordering::equivalent - : (__value_ < 0 ? partial_ordering::less : partial_ordering::greater); - } - - // comparisons - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(weak_ordering, weak_ordering) noexcept = default; - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(weak_ordering __v, _CmpUnspecifiedParam) noexcept { - return __v.__value_ == 0; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(weak_ordering __v, _CmpUnspecifiedParam) noexcept { - return __v.__value_ < 0; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(weak_ordering __v, _CmpUnspecifiedParam) noexcept { - return __v.__value_ <= 0; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(weak_ordering __v, _CmpUnspecifiedParam) noexcept { - return __v.__value_ > 0; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(weak_ordering __v, _CmpUnspecifiedParam) noexcept { - return __v.__value_ >= 0; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(_CmpUnspecifiedParam, weak_ordering __v) noexcept { - return 0 < __v.__value_; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(_CmpUnspecifiedParam, weak_ordering __v) noexcept { - return 0 <= __v.__value_; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(_CmpUnspecifiedParam, weak_ordering __v) noexcept { - return 0 > __v.__value_; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(_CmpUnspecifiedParam, weak_ordering __v) noexcept { - return 0 >= __v.__value_; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr weak_ordering operator<=>(weak_ordering __v, _CmpUnspecifiedParam) noexcept { - return __v; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr weak_ordering operator<=>(_CmpUnspecifiedParam, weak_ordering __v) noexcept { - return __v < 0 ? weak_ordering::greater : (__v > 0 ? weak_ordering::less : __v); - } - -private: - _ValueT __value_; -}; - -inline constexpr weak_ordering weak_ordering::less(_OrdResult::__less); -inline constexpr weak_ordering weak_ordering::equivalent(_OrdResult::__equiv); -inline constexpr weak_ordering weak_ordering::greater(_OrdResult::__greater); - -class strong_ordering { - using _ValueT _LIBCPP_NODEBUG = signed char; - - _LIBCPP_HIDE_FROM_ABI explicit constexpr strong_ordering(_OrdResult __v) noexcept : __value_(_ValueT(__v)) {} - -public: - static const strong_ordering less; - static const strong_ordering equal; - static const strong_ordering equivalent; - static const strong_ordering greater; - - // conversions - _LIBCPP_HIDE_FROM_ABI constexpr operator partial_ordering() const noexcept { - return __value_ == 0 ? partial_ordering::equivalent - : (__value_ < 0 ? partial_ordering::less : partial_ordering::greater); - } - - _LIBCPP_HIDE_FROM_ABI constexpr operator weak_ordering() const noexcept { - return __value_ == 0 ? weak_ordering::equivalent : (__value_ < 0 ? weak_ordering::less : weak_ordering::greater); - } - - // comparisons - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(strong_ordering, strong_ordering) noexcept = default; - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(strong_ordering __v, _CmpUnspecifiedParam) noexcept { - return __v.__value_ == 0; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(strong_ordering __v, _CmpUnspecifiedParam) noexcept { - return __v.__value_ < 0; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(strong_ordering __v, _CmpUnspecifiedParam) noexcept { - return __v.__value_ <= 0; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(strong_ordering __v, _CmpUnspecifiedParam) noexcept { - return __v.__value_ > 0; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(strong_ordering __v, _CmpUnspecifiedParam) noexcept { - return __v.__value_ >= 0; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<(_CmpUnspecifiedParam, strong_ordering __v) noexcept { - return 0 < __v.__value_; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator<=(_CmpUnspecifiedParam, strong_ordering __v) noexcept { - return 0 <= __v.__value_; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>(_CmpUnspecifiedParam, strong_ordering __v) noexcept { - return 0 > __v.__value_; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator>=(_CmpUnspecifiedParam, strong_ordering __v) noexcept { - return 0 >= __v.__value_; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr strong_ordering - operator<=>(strong_ordering __v, _CmpUnspecifiedParam) noexcept { - return __v; - } - - _LIBCPP_HIDE_FROM_ABI friend constexpr strong_ordering - operator<=>(_CmpUnspecifiedParam, strong_ordering __v) noexcept { - return __v < 0 ? strong_ordering::greater : (__v > 0 ? strong_ordering::less : __v); - } - -private: - _ValueT __value_; -}; - -inline constexpr strong_ordering strong_ordering::less(_OrdResult::__less); -inline constexpr strong_ordering strong_ordering::equal(_OrdResult::__equiv); -inline constexpr strong_ordering strong_ordering::equivalent(_OrdResult::__equiv); -inline constexpr strong_ordering strong_ordering::greater(_OrdResult::__greater); - -/// [cmp.categories.pre]/1 -/// The types partial_ordering, weak_ordering, and strong_ordering are -/// collectively termed the comparison category types. -template <class _Tp> -concept __comparison_category = - is_same_v<_Tp, partial_ordering> || is_same_v<_Tp, weak_ordering> || is_same_v<_Tp, strong_ordering>; - -#endif // _LIBCPP_STD_VER >= 20 - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___COMPARE_ORDERING_H diff --git a/third_party/libcxx/include/c++/v1/__compare/partial_order.h b/third_party/libcxx/include/c++/v1/__compare/partial_order.h deleted file mode 100644 index 1d2fae6..0000000 --- a/third_party/libcxx/include/c++/v1/__compare/partial_order.h +++ /dev/null @@ -1,77 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___COMPARE_PARTIAL_ORDER -#define _LIBCPP___COMPARE_PARTIAL_ORDER - -#include <__compare/compare_three_way.h> -#include <__compare/ordering.h> -#include <__compare/weak_order.h> -#include <__config> -#include <__type_traits/decay.h> -#include <__type_traits/is_same.h> -#include <__utility/forward.h> -#include <__utility/priority_tag.h> - -#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 20 - -// [cmp.alg] -namespace __partial_order { -void partial_order() = delete; - -struct __fn { - // NOLINTBEGIN(libcpp-robust-against-adl) partial_order should use ADL, but only here - template <class _Tp, class _Up> - requires is_same_v<decay_t<_Tp>, decay_t<_Up>> - _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<2>) noexcept( - noexcept(partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))) - -> decltype(partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) { - return partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))); - } - // NOLINTEND(libcpp-robust-against-adl) - - template <class _Tp, class _Up> - requires is_same_v<decay_t<_Tp>, decay_t<_Up>> - _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept( - noexcept(partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u))))) - -> decltype(partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) { - return partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u))); - } - - template <class _Tp, class _Up> - requires is_same_v<decay_t<_Tp>, decay_t<_Up>> - _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept( - noexcept(partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))) - -> decltype(partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) { - return partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))); - } - - template <class _Tp, class _Up> - _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const - noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>()))) - -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>())) { - return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>()); - } -}; -} // namespace __partial_order - -inline namespace __cpo { -inline constexpr auto partial_order = __partial_order::__fn{}; -} // namespace __cpo - -#endif // _LIBCPP_STD_VER >= 20 - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___COMPARE_PARTIAL_ORDER diff --git a/third_party/libcxx/include/c++/v1/__compare/strong_order.h b/third_party/libcxx/include/c++/v1/__compare/strong_order.h deleted file mode 100644 index ba6de44..0000000 --- a/third_party/libcxx/include/c++/v1/__compare/strong_order.h +++ /dev/null @@ -1,125 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___COMPARE_STRONG_ORDER -#define _LIBCPP___COMPARE_STRONG_ORDER - -#include <__bit/bit_cast.h> -#include <__compare/compare_three_way.h> -#include <__compare/ordering.h> -#include <__config> -#include <__math/traits.h> -#include <__type_traits/conditional.h> -#include <__type_traits/decay.h> -#include <__type_traits/is_floating_point.h> -#include <__type_traits/is_same.h> -#include <__utility/forward.h> -#include <__utility/priority_tag.h> -#include <cstdint> -#include <limits> - -#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -# pragma GCC system_header -#endif - -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 20 - -// [cmp.alg] -namespace __strong_order { -void strong_order() = delete; - -struct __fn { - // NOLINTBEGIN(libcpp-robust-against-adl) strong_order should use ADL, but only here - template <class _Tp, class _Up> - requires is_same_v<decay_t<_Tp>, decay_t<_Up>> - _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<2>) noexcept( - noexcept(strong_ordering(strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))) - -> decltype(strong_ordering(strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) { - return strong_ordering(strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))); - } - // NOLINTEND(libcpp-robust-against-adl) - - template <class _Tp, class _Up, class _Dp = decay_t<_Tp>> - requires is_same_v<_Dp, decay_t<_Up>> && is_floating_point_v<_Dp> - _LIBCPP_HIDE_FROM_ABI static constexpr strong_ordering __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept { - if constexpr (numeric_limits<_Dp>::is_iec559 && - (sizeof(_Dp) == sizeof(int32_t) || sizeof(_Dp) == sizeof(int64_t))) { - using _IntT = conditional_t<sizeof(_Dp) == sizeof(int32_t), int32_t, int64_t>; - _IntT __rx = std::bit_cast<_IntT>(__t); - _IntT __ry = std::bit_cast<_IntT>(__u); - __rx = (__rx < 0) ? (numeric_limits<_IntT>::min() - __rx - 1) : __rx; - __ry = (__ry < 0) ? (numeric_limits<_IntT>::min() - __ry - 1) : __ry; - return (__rx <=> __ry); - } else if (__t < __u) { - return strong_ordering::less; - } else if (__t > __u) { - return strong_ordering::greater; - } else if (__t == __u) { - static_assert(numeric_limits<_Dp>::radix == 2, "floating point type with a radix other than 2?"); - return __math::signbit(__u) <=> __math::signbit(__t); - } else { - // They're unordered, so one of them must be a NAN. - // The order is -QNAN, -SNAN, numbers, +SNAN, +QNAN. - bool __t_is_nan = __math::isnan(__t); - bool __u_is_nan = __math::isnan(__u); - bool __t_is_negative = __math::signbit(__t); - bool __u_is_negative = __math::signbit(__u); - using _IntType = - conditional_t<sizeof(__t) == sizeof(int32_t), - int32_t, - conditional_t<sizeof(__t) == sizeof(int64_t), int64_t, void>>; - if constexpr (is_same_v<_IntType, void>) { - static_assert(sizeof(_Dp) == 0, "std::strong_order is unimplemented for this floating-point type"); - } else if (__t_is_nan && __u_is_nan) { - // Order by sign bit, then by "payload bits" (we'll just use bit_cast). - if (__t_is_negative != __u_is_negative) { - return (__u_is_negative <=> __t_is_negative); - } else { - return std::bit_cast<_IntType>(__t) <=> std::bit_cast<_IntType>(__u); - } - } else if (__t_is_nan) { - return __t_is_negative ? strong_ordering::less : strong_ordering::greater; - } else { - return __u_is_negative ? strong_ordering::greater : strong_ordering::less; - } - } - } - - template <class _Tp, class _Up> - requires is_same_v<decay_t<_Tp>, decay_t<_Up>> - _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept( - noexcept(strong_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u))))) - -> decltype(strong_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) { - return strong_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u))); - } - - template <class _Tp, class _Up> - _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const - noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>()))) - -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>())) { - return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>()); - } -}; -} // namespace __strong_order - -inline namespace __cpo { -inline constexpr auto strong_order = __strong_order::__fn{}; -} // namespace __cpo - -#endif // _LIBCPP_STD_VER >= 20 - -_LIBCPP_END_NAMESPACE_STD - -_LIBCPP_POP_MACROS - -#endif // _LIBCPP___COMPARE_STRONG_ORDER diff --git a/third_party/libcxx/include/c++/v1/__compare/synth_three_way.h b/third_party/libcxx/include/c++/v1/__compare/synth_three_way.h deleted file mode 100644 index 63bf56d..0000000 --- a/third_party/libcxx/include/c++/v1/__compare/synth_three_way.h +++ /dev/null @@ -1,53 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___COMPARE_SYNTH_THREE_WAY_H -#define _LIBCPP___COMPARE_SYNTH_THREE_WAY_H - -#include <__compare/ordering.h> -#include <__compare/three_way_comparable.h> -#include <__concepts/boolean_testable.h> -#include <__config> -#include <__utility/declval.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 20 - -// [expos.only.func] - -_LIBCPP_HIDE_FROM_ABI inline constexpr auto __synth_three_way = []<class _Tp, class _Up>(const _Tp& __t, const _Up& __u) - requires requires { - { __t < __u } -> __boolean_testable; - { __u < __t } -> __boolean_testable; - } -{ - if constexpr (three_way_comparable_with<_Tp, _Up>) { - return __t <=> __u; - } else { - if (__t < __u) - return weak_ordering::less; - if (__u < __t) - return weak_ordering::greater; - return weak_ordering::equivalent; - } -}; - -template <class _Tp, class _Up = _Tp> -using __synth_three_way_result _LIBCPP_NODEBUG = - decltype(std::__synth_three_way(std::declval<_Tp&>(), std::declval<_Up&>())); - -#endif // _LIBCPP_STD_VER >= 20 - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___COMPARE_SYNTH_THREE_WAY_H diff --git a/third_party/libcxx/include/c++/v1/__compare/three_way_comparable.h b/third_party/libcxx/include/c++/v1/__compare/three_way_comparable.h deleted file mode 100644 index ad6d05a..0000000 --- a/third_party/libcxx/include/c++/v1/__compare/three_way_comparable.h +++ /dev/null @@ -1,55 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___COMPARE_THREE_WAY_COMPARABLE_H -#define _LIBCPP___COMPARE_THREE_WAY_COMPARABLE_H - -#include <__compare/common_comparison_category.h> -#include <__compare/ordering.h> -#include <__concepts/common_reference_with.h> -#include <__concepts/comparison_common_type.h> -#include <__concepts/equality_comparable.h> -#include <__concepts/same_as.h> -#include <__concepts/totally_ordered.h> -#include <__config> -#include <__type_traits/common_reference.h> -#include <__type_traits/make_const_lvalue_ref.h> - -#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 20 - -template <class _Tp, class _Cat> -concept __compares_as = same_as<common_comparison_category_t<_Tp, _Cat>, _Cat>; - -template <class _Tp, class _Cat = partial_ordering> -concept three_way_comparable = - __weakly_equality_comparable_with<_Tp, _Tp> && __partially_ordered_with<_Tp, _Tp> && - requires(__make_const_lvalue_ref<_Tp> __a, __make_const_lvalue_ref<_Tp> __b) { - { __a <=> __b } -> __compares_as<_Cat>; - }; - -template <class _Tp, class _Up, class _Cat = partial_ordering> -concept three_way_comparable_with = - three_way_comparable<_Tp, _Cat> && three_way_comparable<_Up, _Cat> && __comparison_common_type_with<_Tp, _Up> && - three_way_comparable<common_reference_t<__make_const_lvalue_ref<_Tp>, __make_const_lvalue_ref<_Up>>, _Cat> && - __weakly_equality_comparable_with<_Tp, _Up> && __partially_ordered_with<_Tp, _Up> && - requires(__make_const_lvalue_ref<_Tp> __t, __make_const_lvalue_ref<_Up> __u) { - { __t <=> __u } -> __compares_as<_Cat>; - { __u <=> __t } -> __compares_as<_Cat>; - }; - -#endif // _LIBCPP_STD_VER >= 20 - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___COMPARE_THREE_WAY_COMPARABLE_H diff --git a/third_party/libcxx/include/c++/v1/__compare/weak_order.h b/third_party/libcxx/include/c++/v1/__compare/weak_order.h deleted file mode 100644 index 1a3e85f..0000000 --- a/third_party/libcxx/include/c++/v1/__compare/weak_order.h +++ /dev/null @@ -1,105 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef _LIBCPP___COMPARE_WEAK_ORDER -#define _LIBCPP___COMPARE_WEAK_ORDER - -#include <__compare/compare_three_way.h> -#include <__compare/ordering.h> -#include <__compare/strong_order.h> -#include <__config> -#include <__math/traits.h> -#include <__type_traits/decay.h> -#include <__type_traits/is_floating_point.h> -#include <__type_traits/is_same.h> -#include <__utility/forward.h> -#include <__utility/priority_tag.h> - -#ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -# pragma GCC system_header -#endif - -_LIBCPP_BEGIN_NAMESPACE_STD - -#if _LIBCPP_STD_VER >= 20 - -// [cmp.alg] -namespace __weak_order { -void weak_order() = delete; - -struct __fn { - // NOLINTBEGIN(libcpp-robust-against-adl) weak_order should use ADL, but only here - template <class _Tp, class _Up> - requires is_same_v<decay_t<_Tp>, decay_t<_Up>> - _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<3>) noexcept( - noexcept(weak_ordering(weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))) - -> decltype(weak_ordering(weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) { - return weak_ordering(weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))); - } - // NOLINTEND(libcpp-robust-against-adl) - - template <class _Tp, class _Up, class _Dp = decay_t<_Tp>> - requires is_same_v<_Dp, decay_t<_Up>> && is_floating_point_v<_Dp> - _LIBCPP_HIDE_FROM_ABI static constexpr weak_ordering __go(_Tp&& __t, _Up&& __u, __priority_tag<2>) noexcept { - partial_ordering __po = (__t <=> __u); - if (__po == partial_ordering::less) { - return weak_ordering::less; - } else if (__po == partial_ordering::equivalent) { - return weak_ordering::equivalent; - } else if (__po == partial_ordering::greater) { - return weak_ordering::greater; - } else { - // Otherwise, at least one of them is a NaN. - bool __t_is_nan = __math::isnan(__t); - bool __u_is_nan = __math::isnan(__u); - bool __t_is_negative = __math::signbit(__t); - bool __u_is_negative = __math::signbit(__u); - if (__t_is_nan && __u_is_nan) { - return (__u_is_negative <=> __t_is_negative); - } else if (__t_is_nan) { - return __t_is_negative ? weak_ordering::less : weak_ordering::greater; - } else { - return __u_is_negative ? weak_ordering::greater : weak_ordering::less; - } - } - } - - template <class _Tp, class _Up> - requires is_same_v<decay_t<_Tp>, decay_t<_Up>> - _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept( - noexcept(weak_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u))))) - -> decltype(weak_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) { - return weak_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u))); - } - - template <class _Tp, class _Up> - requires is_same_v<decay_t<_Tp>, decay_t<_Up>> - _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept( - noexcept(weak_ordering(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))) - -> decltype(weak_ordering(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) { - return weak_ordering(std::strong_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))); - } - - template <class _Tp, class _Up> - _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const - noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<3>()))) - -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<3>())) { - return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<3>()); - } -}; -} // namespace __weak_order - -inline namespace __cpo { -inline constexpr auto weak_order = __weak_order::__fn{}; -} // namespace __cpo - -#endif // _LIBCPP_STD_VER >= 20 - -_LIBCPP_END_NAMESPACE_STD - -#endif // _LIBCPP___COMPARE_WEAK_ORDER |
