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_COMPARE_PARTIAL_ORDER_FALLBACK
0010 #define _LIBCPP___CXX03___COMPARE_COMPARE_PARTIAL_ORDER_FALLBACK
0011 
0012 #include <__cxx03/__compare/ordering.h>
0013 #include <__cxx03/__compare/partial_order.h>
0014 #include <__cxx03/__config>
0015 #include <__cxx03/__type_traits/decay.h>
0016 #include <__cxx03/__type_traits/is_same.h>
0017 #include <__cxx03/__utility/forward.h>
0018 #include <__cxx03/__utility/priority_tag.h>
0019 
0020 #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
0021 #  pragma GCC system_header
0022 #endif
0023 
0024 _LIBCPP_BEGIN_NAMESPACE_STD
0025 
0026 #if _LIBCPP_STD_VER >= 20
0027 
0028 // [cmp.alg]
0029 namespace __compare_partial_order_fallback {
0030 struct __fn {
0031   template <class _Tp, class _Up>
0032     requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
0033   _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<1>) noexcept(
0034       noexcept(std::partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))))
0035       -> decltype(std::partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u))) {
0036     return std::partial_order(std::forward<_Tp>(__t), std::forward<_Up>(__u));
0037   }
0038 
0039   template <class _Tp, class _Up>
0040     requires is_same_v<decay_t<_Tp>, decay_t<_Up>>
0041   _LIBCPP_HIDE_FROM_ABI static constexpr auto __go(_Tp&& __t, _Up&& __u, __priority_tag<0>) noexcept(noexcept(
0042       std::forward<_Tp>(__t) == std::forward<_Up>(__u)  ? partial_ordering::equivalent
0043       : std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? partial_ordering::less
0044       : std::forward<_Up>(__u) < std::forward<_Tp>(__t)
0045           ? partial_ordering::greater
0046           : partial_ordering::unordered))
0047       -> decltype(std::forward<_Tp>(__t) == std::forward<_Up>(__u)  ? partial_ordering::equivalent
0048                   : std::forward<_Tp>(__t) < std::forward<_Up>(__u) ? partial_ordering::less
0049                   : std::forward<_Up>(__u) < std::forward<_Tp>(__t)
0050                       ? partial_ordering::greater
0051                       : partial_ordering::unordered) {
0052     return std::forward<_Tp>(__t) == std::forward<_Up>(__u) ? partial_ordering::equivalent
0053          : std::forward<_Tp>(__t) < std::forward<_Up>(__u)  ? partial_ordering::less
0054          : std::forward<_Up>(__u) < std::forward<_Tp>(__t)
0055              ? partial_ordering::greater
0056              : partial_ordering::unordered;
0057   }
0058 
0059   template <class _Tp, class _Up>
0060   _LIBCPP_HIDE_FROM_ABI constexpr auto operator()(_Tp&& __t, _Up&& __u) const
0061       noexcept(noexcept(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())))
0062           -> decltype(__go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>())) {
0063     return __go(std::forward<_Tp>(__t), std::forward<_Up>(__u), __priority_tag<1>());
0064   }
0065 };
0066 } // namespace __compare_partial_order_fallback
0067 
0068 inline namespace __cpo {
0069 inline constexpr auto compare_partial_order_fallback = __compare_partial_order_fallback::__fn{};
0070 } // namespace __cpo
0071 
0072 #endif // _LIBCPP_STD_VER >= 20
0073 
0074 _LIBCPP_END_NAMESPACE_STD
0075 
0076 #endif // _LIBCPP___CXX03___COMPARE_COMPARE_PARTIAL_ORDER_FALLBACK