Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:13:25

0001 //===----------------------------------------------------------------------===//
0002 //
0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0004 // See https://llvm.org/LICENSE.txt for license information.
0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0006 //
0007 //===----------------------------------------------------------------------===//
0008 
0009 #ifndef _LIBCPP___CXX03___COMPARE_PARTIAL_ORDER
0010 #define _LIBCPP___CXX03___COMPARE_PARTIAL_ORDER
0011 
0012 #include <__cxx03/__compare/compare_three_way.h>
0013 #include <__cxx03/__compare/ordering.h>
0014 #include <__cxx03/__compare/weak_order.h>
0015 #include <__cxx03/__config>
0016 #include <__cxx03/__type_traits/decay.h>
0017 #include <__cxx03/__type_traits/is_same.h>
0018 #include <__cxx03/__utility/forward.h>
0019 #include <__cxx03/__utility/priority_tag.h>
0020 
0021 #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
0022 #  pragma GCC system_header
0023 #endif
0024 
0025 _LIBCPP_BEGIN_NAMESPACE_STD
0026 
0027 #if _LIBCPP_STD_VER >= 20
0028 
0029 // [cmp.alg]
0030 namespace __partial_order {
0031 void partial_order() = delete;
0032 
0033 struct __fn {
0034   // NOLINTBEGIN(libcpp-robust-against-adl) partial_order should use ADL, but only here
0035   template <class _Tp, class _Up>
0036     requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
0037   _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<2>) noexcept(
0038       noexcept(partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
0039       -> decltype(partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
0040     return partial_ordering(partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
0041   }
0042   // NOLINTEND(libcpp-robust-against-adl)
0043 
0044   template <class _Tp, class _Up>
0045     requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
0046   _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept(
0047       noexcept(partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
0048       -> decltype(partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
0049     return partial_ordering(compare_three_way()(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
0050   }
0051 
0052   template <class _Tp, class _Up>
0053     requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
0054   _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept(
0055       noexcept(partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))))
0056       -> decltype(partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)))) {
0057     return partial_ordering(std::weak_order(std::forward<_Tp>(__t), std::forward<_Up>(__u)));
0058   }
0059 
0060   template <class _Tp, class _Up>
0061   _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
0062       noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>())))
0063           -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>())) {
0064     return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<2>());
0065   }
0066 };
0067 } // namespace __partial_order
0068 
0069 inline namespace __cpo {
0070 inline constexpr auto partial_order = __partial_order::__fn{};
0071 } // namespace __cpo
0072 
0073 #endif // _LIBCPP_STD_VER >= 20
0074 
0075 _LIBCPP_END_NAMESPACE_STD
0076 
0077 #endif // _LIBCPP___CXX03___COMPARE_PARTIAL_ORDER