2 //===----------------------------------------------------------------------===//
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
8 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP___FUNCTIONAL_RANGES_OPERATIONS_H
11 #define _LIBCPP___FUNCTIONAL_RANGES_OPERATIONS_H
13 #include <__concepts/equality_comparable.h>
14 #include <__concepts/totally_ordered.h>
16 #include <__type_traits/integral_constant.h>
17 #include <__type_traits/predicate_traits.h>
18 #include <__utility/forward.h>
20 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
21 # pragma GCC system_header
24 _LIBCPP_BEGIN_NAMESPACE_STD
26 #if _LIBCPP_STD_VER >= 20
31 template <class _Tp
, class _Up
>
32 requires equality_comparable_with
<_Tp
, _Up
>
33 [[nodiscard
]] _LIBCPP_HIDE_FROM_ABI
constexpr bool operator()(_Tp
&&__t
, _Up
&&__u
) const
34 noexcept(noexcept(bool(_VSTD::forward
<_Tp
>(__t
) == _VSTD::forward
<_Up
>(__u
)))) {
35 return _VSTD::forward
<_Tp
>(__t
) == _VSTD::forward
<_Up
>(__u
);
38 using is_transparent
= void;
42 template <class _Tp
, class _Up
>
43 requires equality_comparable_with
<_Tp
, _Up
>
44 [[nodiscard
]] _LIBCPP_HIDE_FROM_ABI
constexpr bool operator()(_Tp
&&__t
, _Up
&&__u
) const
45 noexcept(noexcept(bool(!(_VSTD::forward
<_Tp
>(__t
) == _VSTD::forward
<_Up
>(__u
))))) {
46 return !(_VSTD::forward
<_Tp
>(__t
) == _VSTD::forward
<_Up
>(__u
));
49 using is_transparent
= void;
53 template <class _Tp
, class _Up
>
54 requires totally_ordered_with
<_Tp
, _Up
>
55 [[nodiscard
]] _LIBCPP_HIDE_FROM_ABI
constexpr bool operator()(_Tp
&&__t
, _Up
&&__u
) const
56 noexcept(noexcept(bool(_VSTD::forward
<_Tp
>(__t
) < _VSTD::forward
<_Up
>(__u
)))) {
57 return _VSTD::forward
<_Tp
>(__t
) < _VSTD::forward
<_Up
>(__u
);
60 using is_transparent
= void;
64 template <class _Tp
, class _Up
>
65 requires totally_ordered_with
<_Tp
, _Up
>
66 [[nodiscard
]] _LIBCPP_HIDE_FROM_ABI
constexpr bool operator()(_Tp
&&__t
, _Up
&&__u
) const
67 noexcept(noexcept(bool(!(_VSTD::forward
<_Up
>(__u
) < _VSTD::forward
<_Tp
>(__t
))))) {
68 return !(_VSTD::forward
<_Up
>(__u
) < _VSTD::forward
<_Tp
>(__t
));
71 using is_transparent
= void;
75 template <class _Tp
, class _Up
>
76 requires totally_ordered_with
<_Tp
, _Up
>
77 [[nodiscard
]] _LIBCPP_HIDE_FROM_ABI
constexpr bool operator()(_Tp
&&__t
, _Up
&&__u
) const
78 noexcept(noexcept(bool(_VSTD::forward
<_Up
>(__u
) < _VSTD::forward
<_Tp
>(__t
)))) {
79 return _VSTD::forward
<_Up
>(__u
) < _VSTD::forward
<_Tp
>(__t
);
82 using is_transparent
= void;
85 struct greater_equal
{
86 template <class _Tp
, class _Up
>
87 requires totally_ordered_with
<_Tp
, _Up
>
88 [[nodiscard
]] _LIBCPP_HIDE_FROM_ABI
constexpr bool operator()(_Tp
&&__t
, _Up
&&__u
) const
89 noexcept(noexcept(bool(!(_VSTD::forward
<_Tp
>(__t
) < _VSTD::forward
<_Up
>(__u
))))) {
90 return !(_VSTD::forward
<_Tp
>(__t
) < _VSTD::forward
<_Up
>(__u
));
93 using is_transparent
= void;
98 template <class _Lhs
, class _Rhs
>
99 struct __is_trivial_equality_predicate
<ranges::equal_to
, _Lhs
, _Rhs
> : true_type
{};
101 #endif // _LIBCPP_STD_VER >= 20
103 _LIBCPP_END_NAMESPACE_STD
105 #endif // _LIBCPP___FUNCTIONAL_RANGES_OPERATIONS_H