Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef _LIBCPP___CXX03___FUNCTIONAL_RANGES_OPERATIONS_H
0011 #define _LIBCPP___CXX03___FUNCTIONAL_RANGES_OPERATIONS_H
0012 
0013 #include <__cxx03/__concepts/equality_comparable.h>
0014 #include <__cxx03/__concepts/totally_ordered.h>
0015 #include <__cxx03/__config>
0016 #include <__cxx03/__type_traits/desugars_to.h>
0017 #include <__cxx03/__utility/forward.h>
0018 
0019 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0020 #  pragma GCC system_header
0021 #endif
0022 
0023 _LIBCPP_BEGIN_NAMESPACE_STD
0024 
0025 #if _LIBCPP_STD_VER >= 20
0026 
0027 namespace ranges {
0028 
0029 struct equal_to {
0030   template <class _Tp, class _Up>
0031     requires equality_comparable_with<_Tp, _Up>
0032   [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
0033       noexcept(noexcept(bool(std::forward<_Tp>(__t) == std::forward<_Up>(__u)))) {
0034     return std::forward<_Tp>(__t) == std::forward<_Up>(__u);
0035   }
0036 
0037   using is_transparent = void;
0038 };
0039 
0040 struct not_equal_to {
0041   template <class _Tp, class _Up>
0042     requires equality_comparable_with<_Tp, _Up>
0043   [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
0044       noexcept(noexcept(bool(!(std::forward<_Tp>(__t) == std::forward<_Up>(__u))))) {
0045     return !(std::forward<_Tp>(__t) == std::forward<_Up>(__u));
0046   }
0047 
0048   using is_transparent = void;
0049 };
0050 
0051 struct less {
0052   template <class _Tp, class _Up>
0053     requires totally_ordered_with<_Tp, _Up>
0054   [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
0055       noexcept(noexcept(bool(std::forward<_Tp>(__t) < std::forward<_Up>(__u)))) {
0056     return std::forward<_Tp>(__t) < std::forward<_Up>(__u);
0057   }
0058 
0059   using is_transparent = void;
0060 };
0061 
0062 struct less_equal {
0063   template <class _Tp, class _Up>
0064     requires totally_ordered_with<_Tp, _Up>
0065   [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
0066       noexcept(noexcept(bool(!(std::forward<_Up>(__u) < std::forward<_Tp>(__t))))) {
0067     return !(std::forward<_Up>(__u) < std::forward<_Tp>(__t));
0068   }
0069 
0070   using is_transparent = void;
0071 };
0072 
0073 struct greater {
0074   template <class _Tp, class _Up>
0075     requires totally_ordered_with<_Tp, _Up>
0076   [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
0077       noexcept(noexcept(bool(std::forward<_Up>(__u) < std::forward<_Tp>(__t)))) {
0078     return std::forward<_Up>(__u) < std::forward<_Tp>(__t);
0079   }
0080 
0081   using is_transparent = void;
0082 };
0083 
0084 struct greater_equal {
0085   template <class _Tp, class _Up>
0086     requires totally_ordered_with<_Tp, _Up>
0087   [[nodiscard]] _LIBCPP_HIDE_FROM_ABI constexpr bool operator()(_Tp&& __t, _Up&& __u) const
0088       noexcept(noexcept(bool(!(std::forward<_Tp>(__t) < std::forward<_Up>(__u))))) {
0089     return !(std::forward<_Tp>(__t) < std::forward<_Up>(__u));
0090   }
0091 
0092   using is_transparent = void;
0093 };
0094 
0095 } // namespace ranges
0096 
0097 // For ranges we do not require that the types on each side of the equality
0098 // operator are of the same type
0099 template <class _Tp, class _Up>
0100 inline const bool __desugars_to_v<__equal_tag, ranges::equal_to, _Tp, _Up> = true;
0101 
0102 template <class _Tp, class _Up>
0103 inline const bool __desugars_to_v<__less_tag, ranges::less, _Tp, _Up> = true;
0104 
0105 #endif // _LIBCPP_STD_VER >= 20
0106 
0107 _LIBCPP_END_NAMESPACE_STD
0108 
0109 #endif // _LIBCPP___CXX03___FUNCTIONAL_RANGES_OPERATIONS_H