xref: /freebsd/contrib/llvm-project/libcxx/include/__functional/operations.h (revision fe6060f10f634930ff71b7c50291ddc610da2475)
1*fe6060f1SDimitry Andric // -*- C++ -*-
2*fe6060f1SDimitry Andric //===----------------------------------------------------------------------===//
3*fe6060f1SDimitry Andric //
4*fe6060f1SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5*fe6060f1SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
6*fe6060f1SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7*fe6060f1SDimitry Andric //
8*fe6060f1SDimitry Andric //===----------------------------------------------------------------------===//
9*fe6060f1SDimitry Andric 
10*fe6060f1SDimitry Andric #ifndef _LIBCPP___FUNCTIONAL_OPERATIONS_H
11*fe6060f1SDimitry Andric #define _LIBCPP___FUNCTIONAL_OPERATIONS_H
12*fe6060f1SDimitry Andric 
13*fe6060f1SDimitry Andric #include <__config>
14*fe6060f1SDimitry Andric #include <__functional/binary_function.h>
15*fe6060f1SDimitry Andric #include <__functional/unary_function.h>
16*fe6060f1SDimitry Andric #include <__utility/forward.h>
17*fe6060f1SDimitry Andric 
18*fe6060f1SDimitry Andric #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
19*fe6060f1SDimitry Andric #pragma GCC system_header
20*fe6060f1SDimitry Andric #endif
21*fe6060f1SDimitry Andric 
22*fe6060f1SDimitry Andric _LIBCPP_BEGIN_NAMESPACE_STD
23*fe6060f1SDimitry Andric 
24*fe6060f1SDimitry Andric // Arithmetic operations
25*fe6060f1SDimitry Andric 
26*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_PUSH
27*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
28*fe6060f1SDimitry Andric template <class _Tp = void>
29*fe6060f1SDimitry Andric #else
30*fe6060f1SDimitry Andric template <class _Tp>
31*fe6060f1SDimitry Andric #endif
32*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS plus
33*fe6060f1SDimitry Andric #if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
34*fe6060f1SDimitry Andric     : binary_function<_Tp, _Tp, _Tp>
35*fe6060f1SDimitry Andric #endif
36*fe6060f1SDimitry Andric {
37*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_POP
38*fe6060f1SDimitry Andric     typedef _Tp __result_type;  // used by valarray
39*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
40*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
41*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
42*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
43*fe6060f1SDimitry Andric #endif
44*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
45*fe6060f1SDimitry Andric     _Tp operator()(const _Tp& __x, const _Tp& __y) const
46*fe6060f1SDimitry Andric         {return __x + __y;}
47*fe6060f1SDimitry Andric };
48*fe6060f1SDimitry Andric 
49*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
50*fe6060f1SDimitry Andric template <>
51*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS plus<void>
52*fe6060f1SDimitry Andric {
53*fe6060f1SDimitry Andric     template <class _T1, class _T2>
54*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
55*fe6060f1SDimitry Andric     auto operator()(_T1&& __t, _T2&& __u) const
56*fe6060f1SDimitry Andric     _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) + _VSTD::forward<_T2>(__u)))
57*fe6060f1SDimitry Andric     -> decltype        (_VSTD::forward<_T1>(__t) + _VSTD::forward<_T2>(__u))
58*fe6060f1SDimitry Andric         { return        _VSTD::forward<_T1>(__t) + _VSTD::forward<_T2>(__u); }
59*fe6060f1SDimitry Andric     typedef void is_transparent;
60*fe6060f1SDimitry Andric };
61*fe6060f1SDimitry Andric #endif
62*fe6060f1SDimitry Andric 
63*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_PUSH
64*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
65*fe6060f1SDimitry Andric template <class _Tp = void>
66*fe6060f1SDimitry Andric #else
67*fe6060f1SDimitry Andric template <class _Tp>
68*fe6060f1SDimitry Andric #endif
69*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS minus
70*fe6060f1SDimitry Andric #if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
71*fe6060f1SDimitry Andric     : binary_function<_Tp, _Tp, _Tp>
72*fe6060f1SDimitry Andric #endif
73*fe6060f1SDimitry Andric {
74*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_POP
75*fe6060f1SDimitry Andric     typedef _Tp __result_type;  // used by valarray
76*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
77*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
78*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
79*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
80*fe6060f1SDimitry Andric #endif
81*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
82*fe6060f1SDimitry Andric     _Tp operator()(const _Tp& __x, const _Tp& __y) const
83*fe6060f1SDimitry Andric         {return __x - __y;}
84*fe6060f1SDimitry Andric };
85*fe6060f1SDimitry Andric 
86*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
87*fe6060f1SDimitry Andric template <>
88*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS minus<void>
89*fe6060f1SDimitry Andric {
90*fe6060f1SDimitry Andric     template <class _T1, class _T2>
91*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
92*fe6060f1SDimitry Andric     auto operator()(_T1&& __t, _T2&& __u) const
93*fe6060f1SDimitry Andric     _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) - _VSTD::forward<_T2>(__u)))
94*fe6060f1SDimitry Andric     -> decltype        (_VSTD::forward<_T1>(__t) - _VSTD::forward<_T2>(__u))
95*fe6060f1SDimitry Andric         { return        _VSTD::forward<_T1>(__t) - _VSTD::forward<_T2>(__u); }
96*fe6060f1SDimitry Andric     typedef void is_transparent;
97*fe6060f1SDimitry Andric };
98*fe6060f1SDimitry Andric #endif
99*fe6060f1SDimitry Andric 
100*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_PUSH
101*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
102*fe6060f1SDimitry Andric template <class _Tp = void>
103*fe6060f1SDimitry Andric #else
104*fe6060f1SDimitry Andric template <class _Tp>
105*fe6060f1SDimitry Andric #endif
106*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS multiplies
107*fe6060f1SDimitry Andric #if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
108*fe6060f1SDimitry Andric     : binary_function<_Tp, _Tp, _Tp>
109*fe6060f1SDimitry Andric #endif
110*fe6060f1SDimitry Andric {
111*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_POP
112*fe6060f1SDimitry Andric     typedef _Tp __result_type;  // used by valarray
113*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
114*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
115*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
116*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
117*fe6060f1SDimitry Andric #endif
118*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
119*fe6060f1SDimitry Andric     _Tp operator()(const _Tp& __x, const _Tp& __y) const
120*fe6060f1SDimitry Andric         {return __x * __y;}
121*fe6060f1SDimitry Andric };
122*fe6060f1SDimitry Andric 
123*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
124*fe6060f1SDimitry Andric template <>
125*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS multiplies<void>
126*fe6060f1SDimitry Andric {
127*fe6060f1SDimitry Andric     template <class _T1, class _T2>
128*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
129*fe6060f1SDimitry Andric     auto operator()(_T1&& __t, _T2&& __u) const
130*fe6060f1SDimitry Andric     _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) * _VSTD::forward<_T2>(__u)))
131*fe6060f1SDimitry Andric     -> decltype        (_VSTD::forward<_T1>(__t) * _VSTD::forward<_T2>(__u))
132*fe6060f1SDimitry Andric         { return        _VSTD::forward<_T1>(__t) * _VSTD::forward<_T2>(__u); }
133*fe6060f1SDimitry Andric     typedef void is_transparent;
134*fe6060f1SDimitry Andric };
135*fe6060f1SDimitry Andric #endif
136*fe6060f1SDimitry Andric 
137*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_PUSH
138*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
139*fe6060f1SDimitry Andric template <class _Tp = void>
140*fe6060f1SDimitry Andric #else
141*fe6060f1SDimitry Andric template <class _Tp>
142*fe6060f1SDimitry Andric #endif
143*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS divides
144*fe6060f1SDimitry Andric #if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
145*fe6060f1SDimitry Andric     : binary_function<_Tp, _Tp, _Tp>
146*fe6060f1SDimitry Andric #endif
147*fe6060f1SDimitry Andric {
148*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_POP
149*fe6060f1SDimitry Andric     typedef _Tp __result_type;  // used by valarray
150*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
151*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
152*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
153*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
154*fe6060f1SDimitry Andric #endif
155*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
156*fe6060f1SDimitry Andric     _Tp operator()(const _Tp& __x, const _Tp& __y) const
157*fe6060f1SDimitry Andric         {return __x / __y;}
158*fe6060f1SDimitry Andric };
159*fe6060f1SDimitry Andric 
160*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
161*fe6060f1SDimitry Andric template <>
162*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS divides<void>
163*fe6060f1SDimitry Andric {
164*fe6060f1SDimitry Andric     template <class _T1, class _T2>
165*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
166*fe6060f1SDimitry Andric     auto operator()(_T1&& __t, _T2&& __u) const
167*fe6060f1SDimitry Andric     _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) / _VSTD::forward<_T2>(__u)))
168*fe6060f1SDimitry Andric     -> decltype        (_VSTD::forward<_T1>(__t) / _VSTD::forward<_T2>(__u))
169*fe6060f1SDimitry Andric         { return        _VSTD::forward<_T1>(__t) / _VSTD::forward<_T2>(__u); }
170*fe6060f1SDimitry Andric     typedef void is_transparent;
171*fe6060f1SDimitry Andric };
172*fe6060f1SDimitry Andric #endif
173*fe6060f1SDimitry Andric 
174*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_PUSH
175*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
176*fe6060f1SDimitry Andric template <class _Tp = void>
177*fe6060f1SDimitry Andric #else
178*fe6060f1SDimitry Andric template <class _Tp>
179*fe6060f1SDimitry Andric #endif
180*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS modulus
181*fe6060f1SDimitry Andric #if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
182*fe6060f1SDimitry Andric     : binary_function<_Tp, _Tp, _Tp>
183*fe6060f1SDimitry Andric #endif
184*fe6060f1SDimitry Andric {
185*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_POP
186*fe6060f1SDimitry Andric     typedef _Tp __result_type;  // used by valarray
187*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
188*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
189*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
190*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
191*fe6060f1SDimitry Andric #endif
192*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
193*fe6060f1SDimitry Andric     _Tp operator()(const _Tp& __x, const _Tp& __y) const
194*fe6060f1SDimitry Andric         {return __x % __y;}
195*fe6060f1SDimitry Andric };
196*fe6060f1SDimitry Andric 
197*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
198*fe6060f1SDimitry Andric template <>
199*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS modulus<void>
200*fe6060f1SDimitry Andric {
201*fe6060f1SDimitry Andric     template <class _T1, class _T2>
202*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
203*fe6060f1SDimitry Andric     auto operator()(_T1&& __t, _T2&& __u) const
204*fe6060f1SDimitry Andric     _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) % _VSTD::forward<_T2>(__u)))
205*fe6060f1SDimitry Andric     -> decltype        (_VSTD::forward<_T1>(__t) % _VSTD::forward<_T2>(__u))
206*fe6060f1SDimitry Andric         { return        _VSTD::forward<_T1>(__t) % _VSTD::forward<_T2>(__u); }
207*fe6060f1SDimitry Andric     typedef void is_transparent;
208*fe6060f1SDimitry Andric };
209*fe6060f1SDimitry Andric #endif
210*fe6060f1SDimitry Andric 
211*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_PUSH
212*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
213*fe6060f1SDimitry Andric template <class _Tp = void>
214*fe6060f1SDimitry Andric #else
215*fe6060f1SDimitry Andric template <class _Tp>
216*fe6060f1SDimitry Andric #endif
217*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS negate
218*fe6060f1SDimitry Andric #if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
219*fe6060f1SDimitry Andric     : unary_function<_Tp, _Tp>
220*fe6060f1SDimitry Andric #endif
221*fe6060f1SDimitry Andric {
222*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_POP
223*fe6060f1SDimitry Andric     typedef _Tp __result_type;  // used by valarray
224*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
225*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
226*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp argument_type;
227*fe6060f1SDimitry Andric #endif
228*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
229*fe6060f1SDimitry Andric     _Tp operator()(const _Tp& __x) const
230*fe6060f1SDimitry Andric         {return -__x;}
231*fe6060f1SDimitry Andric };
232*fe6060f1SDimitry Andric 
233*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
234*fe6060f1SDimitry Andric template <>
235*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS negate<void>
236*fe6060f1SDimitry Andric {
237*fe6060f1SDimitry Andric     template <class _Tp>
238*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
239*fe6060f1SDimitry Andric     auto operator()(_Tp&& __x) const
240*fe6060f1SDimitry Andric     _NOEXCEPT_(noexcept(- _VSTD::forward<_Tp>(__x)))
241*fe6060f1SDimitry Andric     -> decltype        (- _VSTD::forward<_Tp>(__x))
242*fe6060f1SDimitry Andric         { return        - _VSTD::forward<_Tp>(__x); }
243*fe6060f1SDimitry Andric     typedef void is_transparent;
244*fe6060f1SDimitry Andric };
245*fe6060f1SDimitry Andric #endif
246*fe6060f1SDimitry Andric 
247*fe6060f1SDimitry Andric // Bitwise operations
248*fe6060f1SDimitry Andric 
249*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_PUSH
250*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
251*fe6060f1SDimitry Andric template <class _Tp = void>
252*fe6060f1SDimitry Andric #else
253*fe6060f1SDimitry Andric template <class _Tp>
254*fe6060f1SDimitry Andric #endif
255*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS bit_and
256*fe6060f1SDimitry Andric #if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
257*fe6060f1SDimitry Andric     : binary_function<_Tp, _Tp, _Tp>
258*fe6060f1SDimitry Andric #endif
259*fe6060f1SDimitry Andric {
260*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_POP
261*fe6060f1SDimitry Andric     typedef _Tp __result_type;  // used by valarray
262*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
263*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
264*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
265*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
266*fe6060f1SDimitry Andric #endif
267*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
268*fe6060f1SDimitry Andric     _Tp operator()(const _Tp& __x, const _Tp& __y) const
269*fe6060f1SDimitry Andric         {return __x & __y;}
270*fe6060f1SDimitry Andric };
271*fe6060f1SDimitry Andric 
272*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
273*fe6060f1SDimitry Andric template <>
274*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS bit_and<void>
275*fe6060f1SDimitry Andric {
276*fe6060f1SDimitry Andric     template <class _T1, class _T2>
277*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
278*fe6060f1SDimitry Andric     auto operator()(_T1&& __t, _T2&& __u) const
279*fe6060f1SDimitry Andric     _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) & _VSTD::forward<_T2>(__u)))
280*fe6060f1SDimitry Andric     -> decltype        (_VSTD::forward<_T1>(__t) & _VSTD::forward<_T2>(__u))
281*fe6060f1SDimitry Andric         { return        _VSTD::forward<_T1>(__t) & _VSTD::forward<_T2>(__u); }
282*fe6060f1SDimitry Andric     typedef void is_transparent;
283*fe6060f1SDimitry Andric };
284*fe6060f1SDimitry Andric #endif
285*fe6060f1SDimitry Andric 
286*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
287*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_PUSH
288*fe6060f1SDimitry Andric template <class _Tp = void>
289*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS bit_not
290*fe6060f1SDimitry Andric #if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
291*fe6060f1SDimitry Andric     : unary_function<_Tp, _Tp>
292*fe6060f1SDimitry Andric #endif
293*fe6060f1SDimitry Andric {
294*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_POP
295*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
296*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
297*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp argument_type;
298*fe6060f1SDimitry Andric #endif
299*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
300*fe6060f1SDimitry Andric     _Tp operator()(const _Tp& __x) const
301*fe6060f1SDimitry Andric         {return ~__x;}
302*fe6060f1SDimitry Andric };
303*fe6060f1SDimitry Andric 
304*fe6060f1SDimitry Andric template <>
305*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS bit_not<void>
306*fe6060f1SDimitry Andric {
307*fe6060f1SDimitry Andric     template <class _Tp>
308*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
309*fe6060f1SDimitry Andric     auto operator()(_Tp&& __x) const
310*fe6060f1SDimitry Andric     _NOEXCEPT_(noexcept(~_VSTD::forward<_Tp>(__x)))
311*fe6060f1SDimitry Andric     -> decltype        (~_VSTD::forward<_Tp>(__x))
312*fe6060f1SDimitry Andric         { return        ~_VSTD::forward<_Tp>(__x); }
313*fe6060f1SDimitry Andric     typedef void is_transparent;
314*fe6060f1SDimitry Andric };
315*fe6060f1SDimitry Andric #endif
316*fe6060f1SDimitry Andric 
317*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_PUSH
318*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
319*fe6060f1SDimitry Andric template <class _Tp = void>
320*fe6060f1SDimitry Andric #else
321*fe6060f1SDimitry Andric template <class _Tp>
322*fe6060f1SDimitry Andric #endif
323*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS bit_or
324*fe6060f1SDimitry Andric #if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
325*fe6060f1SDimitry Andric     : binary_function<_Tp, _Tp, _Tp>
326*fe6060f1SDimitry Andric #endif
327*fe6060f1SDimitry Andric {
328*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_POP
329*fe6060f1SDimitry Andric     typedef _Tp __result_type;  // used by valarray
330*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
331*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
332*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
333*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
334*fe6060f1SDimitry Andric #endif
335*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
336*fe6060f1SDimitry Andric     _Tp operator()(const _Tp& __x, const _Tp& __y) const
337*fe6060f1SDimitry Andric         {return __x | __y;}
338*fe6060f1SDimitry Andric };
339*fe6060f1SDimitry Andric 
340*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
341*fe6060f1SDimitry Andric template <>
342*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS bit_or<void>
343*fe6060f1SDimitry Andric {
344*fe6060f1SDimitry Andric     template <class _T1, class _T2>
345*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
346*fe6060f1SDimitry Andric     auto operator()(_T1&& __t, _T2&& __u) const
347*fe6060f1SDimitry Andric     _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) | _VSTD::forward<_T2>(__u)))
348*fe6060f1SDimitry Andric     -> decltype        (_VSTD::forward<_T1>(__t) | _VSTD::forward<_T2>(__u))
349*fe6060f1SDimitry Andric         { return        _VSTD::forward<_T1>(__t) | _VSTD::forward<_T2>(__u); }
350*fe6060f1SDimitry Andric     typedef void is_transparent;
351*fe6060f1SDimitry Andric };
352*fe6060f1SDimitry Andric #endif
353*fe6060f1SDimitry Andric 
354*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_PUSH
355*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
356*fe6060f1SDimitry Andric template <class _Tp = void>
357*fe6060f1SDimitry Andric #else
358*fe6060f1SDimitry Andric template <class _Tp>
359*fe6060f1SDimitry Andric #endif
360*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS bit_xor
361*fe6060f1SDimitry Andric #if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
362*fe6060f1SDimitry Andric     : binary_function<_Tp, _Tp, _Tp>
363*fe6060f1SDimitry Andric #endif
364*fe6060f1SDimitry Andric {
365*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_POP
366*fe6060f1SDimitry Andric     typedef _Tp __result_type;  // used by valarray
367*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
368*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp result_type;
369*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
370*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
371*fe6060f1SDimitry Andric #endif
372*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
373*fe6060f1SDimitry Andric     _Tp operator()(const _Tp& __x, const _Tp& __y) const
374*fe6060f1SDimitry Andric         {return __x ^ __y;}
375*fe6060f1SDimitry Andric };
376*fe6060f1SDimitry Andric 
377*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
378*fe6060f1SDimitry Andric template <>
379*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS bit_xor<void>
380*fe6060f1SDimitry Andric {
381*fe6060f1SDimitry Andric     template <class _T1, class _T2>
382*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
383*fe6060f1SDimitry Andric     auto operator()(_T1&& __t, _T2&& __u) const
384*fe6060f1SDimitry Andric     _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) ^ _VSTD::forward<_T2>(__u)))
385*fe6060f1SDimitry Andric     -> decltype        (_VSTD::forward<_T1>(__t) ^ _VSTD::forward<_T2>(__u))
386*fe6060f1SDimitry Andric         { return        _VSTD::forward<_T1>(__t) ^ _VSTD::forward<_T2>(__u); }
387*fe6060f1SDimitry Andric     typedef void is_transparent;
388*fe6060f1SDimitry Andric };
389*fe6060f1SDimitry Andric #endif
390*fe6060f1SDimitry Andric 
391*fe6060f1SDimitry Andric // Comparison operations
392*fe6060f1SDimitry Andric 
393*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_PUSH
394*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
395*fe6060f1SDimitry Andric template <class _Tp = void>
396*fe6060f1SDimitry Andric #else
397*fe6060f1SDimitry Andric template <class _Tp>
398*fe6060f1SDimitry Andric #endif
399*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS equal_to
400*fe6060f1SDimitry Andric #if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
401*fe6060f1SDimitry Andric     : binary_function<_Tp, _Tp, bool>
402*fe6060f1SDimitry Andric #endif
403*fe6060f1SDimitry Andric {
404*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_POP
405*fe6060f1SDimitry Andric     typedef bool __result_type;  // used by valarray
406*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
407*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
408*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
409*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
410*fe6060f1SDimitry Andric #endif
411*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
412*fe6060f1SDimitry Andric     bool operator()(const _Tp& __x, const _Tp& __y) const
413*fe6060f1SDimitry Andric         {return __x == __y;}
414*fe6060f1SDimitry Andric };
415*fe6060f1SDimitry Andric 
416*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
417*fe6060f1SDimitry Andric template <>
418*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS equal_to<void>
419*fe6060f1SDimitry Andric {
420*fe6060f1SDimitry Andric     template <class _T1, class _T2>
421*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
422*fe6060f1SDimitry Andric     auto operator()(_T1&& __t, _T2&& __u) const
423*fe6060f1SDimitry Andric     _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) == _VSTD::forward<_T2>(__u)))
424*fe6060f1SDimitry Andric     -> decltype        (_VSTD::forward<_T1>(__t) == _VSTD::forward<_T2>(__u))
425*fe6060f1SDimitry Andric         { return        _VSTD::forward<_T1>(__t) == _VSTD::forward<_T2>(__u); }
426*fe6060f1SDimitry Andric     typedef void is_transparent;
427*fe6060f1SDimitry Andric };
428*fe6060f1SDimitry Andric #endif
429*fe6060f1SDimitry Andric 
430*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_PUSH
431*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
432*fe6060f1SDimitry Andric template <class _Tp = void>
433*fe6060f1SDimitry Andric #else
434*fe6060f1SDimitry Andric template <class _Tp>
435*fe6060f1SDimitry Andric #endif
436*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS not_equal_to
437*fe6060f1SDimitry Andric #if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
438*fe6060f1SDimitry Andric     : binary_function<_Tp, _Tp, bool>
439*fe6060f1SDimitry Andric #endif
440*fe6060f1SDimitry Andric {
441*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_POP
442*fe6060f1SDimitry Andric     typedef bool __result_type;  // used by valarray
443*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
444*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
445*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
446*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
447*fe6060f1SDimitry Andric #endif
448*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
449*fe6060f1SDimitry Andric     bool operator()(const _Tp& __x, const _Tp& __y) const
450*fe6060f1SDimitry Andric         {return __x != __y;}
451*fe6060f1SDimitry Andric };
452*fe6060f1SDimitry Andric 
453*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
454*fe6060f1SDimitry Andric template <>
455*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS not_equal_to<void>
456*fe6060f1SDimitry Andric {
457*fe6060f1SDimitry Andric     template <class _T1, class _T2>
458*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
459*fe6060f1SDimitry Andric     auto operator()(_T1&& __t, _T2&& __u) const
460*fe6060f1SDimitry Andric     _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) != _VSTD::forward<_T2>(__u)))
461*fe6060f1SDimitry Andric     -> decltype        (_VSTD::forward<_T1>(__t) != _VSTD::forward<_T2>(__u))
462*fe6060f1SDimitry Andric         { return        _VSTD::forward<_T1>(__t) != _VSTD::forward<_T2>(__u); }
463*fe6060f1SDimitry Andric     typedef void is_transparent;
464*fe6060f1SDimitry Andric };
465*fe6060f1SDimitry Andric #endif
466*fe6060f1SDimitry Andric 
467*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_PUSH
468*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
469*fe6060f1SDimitry Andric template <class _Tp = void>
470*fe6060f1SDimitry Andric #else
471*fe6060f1SDimitry Andric template <class _Tp>
472*fe6060f1SDimitry Andric #endif
473*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS less
474*fe6060f1SDimitry Andric #if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
475*fe6060f1SDimitry Andric     : binary_function<_Tp, _Tp, bool>
476*fe6060f1SDimitry Andric #endif
477*fe6060f1SDimitry Andric {
478*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_POP
479*fe6060f1SDimitry Andric     typedef bool __result_type;  // used by valarray
480*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
481*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
482*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
483*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
484*fe6060f1SDimitry Andric #endif
485*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
486*fe6060f1SDimitry Andric     bool operator()(const _Tp& __x, const _Tp& __y) const
487*fe6060f1SDimitry Andric         {return __x < __y;}
488*fe6060f1SDimitry Andric };
489*fe6060f1SDimitry Andric 
490*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
491*fe6060f1SDimitry Andric template <>
492*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS less<void>
493*fe6060f1SDimitry Andric {
494*fe6060f1SDimitry Andric     template <class _T1, class _T2>
495*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
496*fe6060f1SDimitry Andric     auto operator()(_T1&& __t, _T2&& __u) const
497*fe6060f1SDimitry Andric     _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u)))
498*fe6060f1SDimitry Andric     -> decltype        (_VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u))
499*fe6060f1SDimitry Andric         { return        _VSTD::forward<_T1>(__t) < _VSTD::forward<_T2>(__u); }
500*fe6060f1SDimitry Andric     typedef void is_transparent;
501*fe6060f1SDimitry Andric };
502*fe6060f1SDimitry Andric #endif
503*fe6060f1SDimitry Andric 
504*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_PUSH
505*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
506*fe6060f1SDimitry Andric template <class _Tp = void>
507*fe6060f1SDimitry Andric #else
508*fe6060f1SDimitry Andric template <class _Tp>
509*fe6060f1SDimitry Andric #endif
510*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS less_equal
511*fe6060f1SDimitry Andric #if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
512*fe6060f1SDimitry Andric     : binary_function<_Tp, _Tp, bool>
513*fe6060f1SDimitry Andric #endif
514*fe6060f1SDimitry Andric {
515*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_POP
516*fe6060f1SDimitry Andric     typedef bool __result_type;  // used by valarray
517*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
518*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
519*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
520*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
521*fe6060f1SDimitry Andric #endif
522*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
523*fe6060f1SDimitry Andric     bool operator()(const _Tp& __x, const _Tp& __y) const
524*fe6060f1SDimitry Andric         {return __x <= __y;}
525*fe6060f1SDimitry Andric };
526*fe6060f1SDimitry Andric 
527*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
528*fe6060f1SDimitry Andric template <>
529*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS less_equal<void>
530*fe6060f1SDimitry Andric {
531*fe6060f1SDimitry Andric     template <class _T1, class _T2>
532*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
533*fe6060f1SDimitry Andric     auto operator()(_T1&& __t, _T2&& __u) const
534*fe6060f1SDimitry Andric     _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) <= _VSTD::forward<_T2>(__u)))
535*fe6060f1SDimitry Andric     -> decltype        (_VSTD::forward<_T1>(__t) <= _VSTD::forward<_T2>(__u))
536*fe6060f1SDimitry Andric         { return        _VSTD::forward<_T1>(__t) <= _VSTD::forward<_T2>(__u); }
537*fe6060f1SDimitry Andric     typedef void is_transparent;
538*fe6060f1SDimitry Andric };
539*fe6060f1SDimitry Andric #endif
540*fe6060f1SDimitry Andric 
541*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_PUSH
542*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
543*fe6060f1SDimitry Andric template <class _Tp = void>
544*fe6060f1SDimitry Andric #else
545*fe6060f1SDimitry Andric template <class _Tp>
546*fe6060f1SDimitry Andric #endif
547*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS greater_equal
548*fe6060f1SDimitry Andric #if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
549*fe6060f1SDimitry Andric     : binary_function<_Tp, _Tp, bool>
550*fe6060f1SDimitry Andric #endif
551*fe6060f1SDimitry Andric {
552*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_POP
553*fe6060f1SDimitry Andric     typedef bool __result_type;  // used by valarray
554*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
555*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
556*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
557*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
558*fe6060f1SDimitry Andric #endif
559*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
560*fe6060f1SDimitry Andric     bool operator()(const _Tp& __x, const _Tp& __y) const
561*fe6060f1SDimitry Andric         {return __x >= __y;}
562*fe6060f1SDimitry Andric };
563*fe6060f1SDimitry Andric 
564*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
565*fe6060f1SDimitry Andric template <>
566*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS greater_equal<void>
567*fe6060f1SDimitry Andric {
568*fe6060f1SDimitry Andric     template <class _T1, class _T2>
569*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
570*fe6060f1SDimitry Andric     auto operator()(_T1&& __t, _T2&& __u) const
571*fe6060f1SDimitry Andric     _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) >= _VSTD::forward<_T2>(__u)))
572*fe6060f1SDimitry Andric     -> decltype        (_VSTD::forward<_T1>(__t) >= _VSTD::forward<_T2>(__u))
573*fe6060f1SDimitry Andric         { return        _VSTD::forward<_T1>(__t) >= _VSTD::forward<_T2>(__u); }
574*fe6060f1SDimitry Andric     typedef void is_transparent;
575*fe6060f1SDimitry Andric };
576*fe6060f1SDimitry Andric #endif
577*fe6060f1SDimitry Andric 
578*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_PUSH
579*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
580*fe6060f1SDimitry Andric template <class _Tp = void>
581*fe6060f1SDimitry Andric #else
582*fe6060f1SDimitry Andric template <class _Tp>
583*fe6060f1SDimitry Andric #endif
584*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS greater
585*fe6060f1SDimitry Andric #if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
586*fe6060f1SDimitry Andric     : binary_function<_Tp, _Tp, bool>
587*fe6060f1SDimitry Andric #endif
588*fe6060f1SDimitry Andric {
589*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_POP
590*fe6060f1SDimitry Andric     typedef bool __result_type;  // used by valarray
591*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
592*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
593*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
594*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
595*fe6060f1SDimitry Andric #endif
596*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
597*fe6060f1SDimitry Andric     bool operator()(const _Tp& __x, const _Tp& __y) const
598*fe6060f1SDimitry Andric         {return __x > __y;}
599*fe6060f1SDimitry Andric };
600*fe6060f1SDimitry Andric 
601*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
602*fe6060f1SDimitry Andric template <>
603*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS greater<void>
604*fe6060f1SDimitry Andric {
605*fe6060f1SDimitry Andric     template <class _T1, class _T2>
606*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
607*fe6060f1SDimitry Andric     auto operator()(_T1&& __t, _T2&& __u) const
608*fe6060f1SDimitry Andric     _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) > _VSTD::forward<_T2>(__u)))
609*fe6060f1SDimitry Andric     -> decltype        (_VSTD::forward<_T1>(__t) > _VSTD::forward<_T2>(__u))
610*fe6060f1SDimitry Andric         { return        _VSTD::forward<_T1>(__t) > _VSTD::forward<_T2>(__u); }
611*fe6060f1SDimitry Andric     typedef void is_transparent;
612*fe6060f1SDimitry Andric };
613*fe6060f1SDimitry Andric #endif
614*fe6060f1SDimitry Andric 
615*fe6060f1SDimitry Andric // Logical operations
616*fe6060f1SDimitry Andric 
617*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_PUSH
618*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
619*fe6060f1SDimitry Andric template <class _Tp = void>
620*fe6060f1SDimitry Andric #else
621*fe6060f1SDimitry Andric template <class _Tp>
622*fe6060f1SDimitry Andric #endif
623*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS logical_and
624*fe6060f1SDimitry Andric #if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
625*fe6060f1SDimitry Andric     : binary_function<_Tp, _Tp, bool>
626*fe6060f1SDimitry Andric #endif
627*fe6060f1SDimitry Andric {
628*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_POP
629*fe6060f1SDimitry Andric     typedef bool __result_type;  // used by valarray
630*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
631*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
632*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
633*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
634*fe6060f1SDimitry Andric #endif
635*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
636*fe6060f1SDimitry Andric     bool operator()(const _Tp& __x, const _Tp& __y) const
637*fe6060f1SDimitry Andric         {return __x && __y;}
638*fe6060f1SDimitry Andric };
639*fe6060f1SDimitry Andric 
640*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
641*fe6060f1SDimitry Andric template <>
642*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS logical_and<void>
643*fe6060f1SDimitry Andric {
644*fe6060f1SDimitry Andric     template <class _T1, class _T2>
645*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
646*fe6060f1SDimitry Andric     auto operator()(_T1&& __t, _T2&& __u) const
647*fe6060f1SDimitry Andric     _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) && _VSTD::forward<_T2>(__u)))
648*fe6060f1SDimitry Andric     -> decltype        (_VSTD::forward<_T1>(__t) && _VSTD::forward<_T2>(__u))
649*fe6060f1SDimitry Andric         { return        _VSTD::forward<_T1>(__t) && _VSTD::forward<_T2>(__u); }
650*fe6060f1SDimitry Andric     typedef void is_transparent;
651*fe6060f1SDimitry Andric };
652*fe6060f1SDimitry Andric #endif
653*fe6060f1SDimitry Andric 
654*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_PUSH
655*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
656*fe6060f1SDimitry Andric template <class _Tp = void>
657*fe6060f1SDimitry Andric #else
658*fe6060f1SDimitry Andric template <class _Tp>
659*fe6060f1SDimitry Andric #endif
660*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS logical_not
661*fe6060f1SDimitry Andric #if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
662*fe6060f1SDimitry Andric     : unary_function<_Tp, bool>
663*fe6060f1SDimitry Andric #endif
664*fe6060f1SDimitry Andric {
665*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_POP
666*fe6060f1SDimitry Andric     typedef bool __result_type;  // used by valarray
667*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
668*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
669*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp argument_type;
670*fe6060f1SDimitry Andric #endif
671*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
672*fe6060f1SDimitry Andric     bool operator()(const _Tp& __x) const
673*fe6060f1SDimitry Andric         {return !__x;}
674*fe6060f1SDimitry Andric };
675*fe6060f1SDimitry Andric 
676*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
677*fe6060f1SDimitry Andric template <>
678*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS logical_not<void>
679*fe6060f1SDimitry Andric {
680*fe6060f1SDimitry Andric     template <class _Tp>
681*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
682*fe6060f1SDimitry Andric     auto operator()(_Tp&& __x) const
683*fe6060f1SDimitry Andric     _NOEXCEPT_(noexcept(!_VSTD::forward<_Tp>(__x)))
684*fe6060f1SDimitry Andric     -> decltype        (!_VSTD::forward<_Tp>(__x))
685*fe6060f1SDimitry Andric         { return        !_VSTD::forward<_Tp>(__x); }
686*fe6060f1SDimitry Andric     typedef void is_transparent;
687*fe6060f1SDimitry Andric };
688*fe6060f1SDimitry Andric #endif
689*fe6060f1SDimitry Andric 
690*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_PUSH
691*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
692*fe6060f1SDimitry Andric template <class _Tp = void>
693*fe6060f1SDimitry Andric #else
694*fe6060f1SDimitry Andric template <class _Tp>
695*fe6060f1SDimitry Andric #endif
696*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS logical_or
697*fe6060f1SDimitry Andric #if !defined(_LIBCPP_ABI_NO_BINDER_BASES)
698*fe6060f1SDimitry Andric     : binary_function<_Tp, _Tp, bool>
699*fe6060f1SDimitry Andric #endif
700*fe6060f1SDimitry Andric {
701*fe6060f1SDimitry Andric _LIBCPP_SUPPRESS_DEPRECATED_POP
702*fe6060f1SDimitry Andric     typedef bool __result_type;  // used by valarray
703*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER <= 17 || defined(_LIBCPP_ENABLE_CXX20_REMOVED_BINDER_TYPEDEFS)
704*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef bool result_type;
705*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp first_argument_type;
706*fe6060f1SDimitry Andric     _LIBCPP_DEPRECATED_IN_CXX17 typedef _Tp second_argument_type;
707*fe6060f1SDimitry Andric #endif
708*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
709*fe6060f1SDimitry Andric     bool operator()(const _Tp& __x, const _Tp& __y) const
710*fe6060f1SDimitry Andric         {return __x || __y;}
711*fe6060f1SDimitry Andric };
712*fe6060f1SDimitry Andric 
713*fe6060f1SDimitry Andric #if _LIBCPP_STD_VER > 11
714*fe6060f1SDimitry Andric template <>
715*fe6060f1SDimitry Andric struct _LIBCPP_TEMPLATE_VIS logical_or<void>
716*fe6060f1SDimitry Andric {
717*fe6060f1SDimitry Andric     template <class _T1, class _T2>
718*fe6060f1SDimitry Andric     _LIBCPP_CONSTEXPR_AFTER_CXX11 _LIBCPP_INLINE_VISIBILITY
719*fe6060f1SDimitry Andric     auto operator()(_T1&& __t, _T2&& __u) const
720*fe6060f1SDimitry Andric     _NOEXCEPT_(noexcept(_VSTD::forward<_T1>(__t) || _VSTD::forward<_T2>(__u)))
721*fe6060f1SDimitry Andric     -> decltype        (_VSTD::forward<_T1>(__t) || _VSTD::forward<_T2>(__u))
722*fe6060f1SDimitry Andric         { return        _VSTD::forward<_T1>(__t) || _VSTD::forward<_T2>(__u); }
723*fe6060f1SDimitry Andric     typedef void is_transparent;
724*fe6060f1SDimitry Andric };
725*fe6060f1SDimitry Andric #endif
726*fe6060f1SDimitry Andric 
727*fe6060f1SDimitry Andric _LIBCPP_END_NAMESPACE_STD
728*fe6060f1SDimitry Andric 
729*fe6060f1SDimitry Andric #endif // _LIBCPP___FUNCTIONAL_OPERATIONS_H
730