1// -*- C++ -*-
2//===----------------------------------------------------------------------===//
3//
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
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef _LIBCPP___FUNCTIONAL_OPERATIONS_H
11#define _LIBCPP___FUNCTIONAL_OPERATIONS_H
12
13#include <__config>
14#include <__functional/binary_function.h>
15#include <__functional/unary_function.h>
16#include <__fwd/functional.h>
17#include <__type_traits/desugars_to.h>
18#include <__type_traits/is_generic_transparent_comparator.h>
19#include <__type_traits/is_integral.h>
20#include <__type_traits/make_transparent.h>
21#include <__utility/forward.h>
22
23#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
24# pragma GCC system_header
25#endif
26
27_LIBCPP_BEGIN_NAMESPACE_STD
28
29// Arithmetic operations
30
31#if _LIBCPP_STD_VER >= 14
32template <class _Tp = void>
33#else
34template <class _Tp>
35#endif
36struct plus : __binary_function<_Tp, _Tp, _Tp> {
37 typedef _Tp __result_type; // used by valarray
38 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
39 return __x + __y;
40 }
41};
42_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(plus);
43
44// The non-transparent std::plus specialization is only equivalent to a raw plus
45// operator when we don't perform an implicit conversion when calling it.
46template <class _Tp>
47inline const bool __desugars_to_v<__plus_tag, plus<_Tp>, _Tp, _Tp> = true;
48
49template <class _Tp, class _Up>
50inline const bool __desugars_to_v<__plus_tag, plus<void>, _Tp, _Up> = true;
51
52#if _LIBCPP_STD_VER >= 14
53template <>
54struct plus<void> {
55 template <class _T1, class _T2>
56 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
57 noexcept(noexcept(std::forward<_T1>(__t) + std::forward<_T2>(__u))) //
58 -> decltype(std::forward<_T1>(__t) + std::forward<_T2>(__u)) {
59 return std::forward<_T1>(__t) + std::forward<_T2>(__u);
60 }
61 typedef void is_transparent;
62};
63#endif
64
65#if _LIBCPP_STD_VER >= 14
66template <class _Tp = void>
67#else
68template <class _Tp>
69#endif
70struct minus : __binary_function<_Tp, _Tp, _Tp> {
71 typedef _Tp __result_type; // used by valarray
72 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
73 return __x - __y;
74 }
75};
76_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(minus);
77
78#if _LIBCPP_STD_VER >= 14
79template <>
80struct minus<void> {
81 template <class _T1, class _T2>
82 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
83 noexcept(noexcept(std::forward<_T1>(__t) - std::forward<_T2>(__u))) //
84 -> decltype(std::forward<_T1>(__t) - std::forward<_T2>(__u)) {
85 return std::forward<_T1>(__t) - std::forward<_T2>(__u);
86 }
87 typedef void is_transparent;
88};
89#endif
90
91#if _LIBCPP_STD_VER >= 14
92template <class _Tp = void>
93#else
94template <class _Tp>
95#endif
96struct multiplies : __binary_function<_Tp, _Tp, _Tp> {
97 typedef _Tp __result_type; // used by valarray
98 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
99 return __x * __y;
100 }
101};
102_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(multiplies);
103
104#if _LIBCPP_STD_VER >= 14
105template <>
106struct multiplies<void> {
107 template <class _T1, class _T2>
108 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
109 noexcept(noexcept(std::forward<_T1>(__t) * std::forward<_T2>(__u))) //
110 -> decltype(std::forward<_T1>(__t) * std::forward<_T2>(__u)) {
111 return std::forward<_T1>(__t) * std::forward<_T2>(__u);
112 }
113 typedef void is_transparent;
114};
115#endif
116
117#if _LIBCPP_STD_VER >= 14
118template <class _Tp = void>
119#else
120template <class _Tp>
121#endif
122struct divides : __binary_function<_Tp, _Tp, _Tp> {
123 typedef _Tp __result_type; // used by valarray
124 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
125 return __x / __y;
126 }
127};
128_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(divides);
129
130#if _LIBCPP_STD_VER >= 14
131template <>
132struct divides<void> {
133 template <class _T1, class _T2>
134 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
135 noexcept(noexcept(std::forward<_T1>(__t) / std::forward<_T2>(__u))) //
136 -> decltype(std::forward<_T1>(__t) / std::forward<_T2>(__u)) {
137 return std::forward<_T1>(__t) / std::forward<_T2>(__u);
138 }
139 typedef void is_transparent;
140};
141#endif
142
143#if _LIBCPP_STD_VER >= 14
144template <class _Tp = void>
145#else
146template <class _Tp>
147#endif
148struct modulus : __binary_function<_Tp, _Tp, _Tp> {
149 typedef _Tp __result_type; // used by valarray
150 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
151 return __x % __y;
152 }
153};
154_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(modulus);
155
156#if _LIBCPP_STD_VER >= 14
157template <>
158struct modulus<void> {
159 template <class _T1, class _T2>
160 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
161 noexcept(noexcept(std::forward<_T1>(__t) % std::forward<_T2>(__u))) //
162 -> decltype(std::forward<_T1>(__t) % std::forward<_T2>(__u)) {
163 return std::forward<_T1>(__t) % std::forward<_T2>(__u);
164 }
165 typedef void is_transparent;
166};
167#endif
168
169#if _LIBCPP_STD_VER >= 14
170template <class _Tp = void>
171#else
172template <class _Tp>
173#endif
174struct negate : __unary_function<_Tp, _Tp> {
175 typedef _Tp __result_type; // used by valarray
176 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return -__x; }
177};
178_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(negate);
179
180#if _LIBCPP_STD_VER >= 14
181template <>
182struct negate<void> {
183 template <class _Tp>
184 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_Tp&& __x) const
185 noexcept(noexcept(-std::forward<_Tp>(__x))) //
186 -> decltype(-std::forward<_Tp>(__x)) {
187 return -std::forward<_Tp>(__x);
188 }
189 typedef void is_transparent;
190};
191#endif
192
193// Bitwise operations
194
195#if _LIBCPP_STD_VER >= 14
196template <class _Tp = void>
197#else
198template <class _Tp>
199#endif
200struct bit_and : __binary_function<_Tp, _Tp, _Tp> {
201 typedef _Tp __result_type; // used by valarray
202 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
203 return __x & __y;
204 }
205};
206_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_and);
207
208#if _LIBCPP_STD_VER >= 14
209template <>
210struct bit_and<void> {
211 template <class _T1, class _T2>
212 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
213 noexcept(noexcept(std::forward<_T1>(__t) &
214 std::forward<_T2>(__u))) -> decltype(std::forward<_T1>(__t) & std::forward<_T2>(__u)) {
215 return std::forward<_T1>(__t) & std::forward<_T2>(__u);
216 }
217 typedef void is_transparent;
218};
219#endif
220
221#if _LIBCPP_STD_VER >= 14
222template <class _Tp = void>
223struct bit_not : __unary_function<_Tp, _Tp> {
224 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return ~__x; }
225};
226_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_not);
227
228template <>
229struct bit_not<void> {
230 template <class _Tp>
231 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_Tp&& __x) const
232 noexcept(noexcept(~std::forward<_Tp>(__x))) //
233 -> decltype(~std::forward<_Tp>(__x)) {
234 return ~std::forward<_Tp>(__x);
235 }
236 typedef void is_transparent;
237};
238#endif
239
240#if _LIBCPP_STD_VER >= 14
241template <class _Tp = void>
242#else
243template <class _Tp>
244#endif
245struct bit_or : __binary_function<_Tp, _Tp, _Tp> {
246 typedef _Tp __result_type; // used by valarray
247 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
248 return __x | __y;
249 }
250};
251_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_or);
252
253#if _LIBCPP_STD_VER >= 14
254template <>
255struct bit_or<void> {
256 template <class _T1, class _T2>
257 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
258 noexcept(noexcept(std::forward<_T1>(__t) | std::forward<_T2>(__u))) //
259 -> decltype(std::forward<_T1>(__t) | std::forward<_T2>(__u)) {
260 return std::forward<_T1>(__t) | std::forward<_T2>(__u);
261 }
262 typedef void is_transparent;
263};
264#endif
265
266#if _LIBCPP_STD_VER >= 14
267template <class _Tp = void>
268#else
269template <class _Tp>
270#endif
271struct bit_xor : __binary_function<_Tp, _Tp, _Tp> {
272 typedef _Tp __result_type; // used by valarray
273 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
274 return __x ^ __y;
275 }
276};
277_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_xor);
278
279#if _LIBCPP_STD_VER >= 14
280template <>
281struct bit_xor<void> {
282 template <class _T1, class _T2>
283 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
284 noexcept(noexcept(std::forward<_T1>(__t) ^ std::forward<_T2>(__u))) //
285 -> decltype(std::forward<_T1>(__t) ^ std::forward<_T2>(__u)) {
286 return std::forward<_T1>(__t) ^ std::forward<_T2>(__u);
287 }
288 typedef void is_transparent;
289};
290#endif
291
292// Comparison operations
293
294#if _LIBCPP_STD_VER >= 14
295template <class _Tp = void>
296#else
297template <class _Tp>
298#endif
299struct equal_to : __binary_function<_Tp, _Tp, bool> {
300 typedef bool __result_type; // used by valarray
301 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
302 return __x == __y;
303 }
304};
305_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(equal_to);
306
307#if _LIBCPP_STD_VER >= 14
308template <>
309struct equal_to<void> {
310 template <class _T1, class _T2>
311 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
312 noexcept(noexcept(std::forward<_T1>(__t) == std::forward<_T2>(__u))) //
313 -> decltype(std::forward<_T1>(__t) == std::forward<_T2>(__u)) {
314 return std::forward<_T1>(__t) == std::forward<_T2>(__u);
315 }
316 typedef void is_transparent;
317};
318#endif
319
320// The non-transparent std::equal_to specialization is only equivalent to a raw equality
321// comparison when we don't perform an implicit conversion when calling it.
322template <class _Tp>
323inline const bool __desugars_to_v<__equal_tag, equal_to<_Tp>, _Tp, _Tp> = true;
324
325// In the transparent case, we do not enforce that
326template <class _Tp, class _Up>
327inline const bool __desugars_to_v<__equal_tag, equal_to<void>, _Tp, _Up> = true;
328
329#if _LIBCPP_STD_VER >= 14
330template <class _Tp = void>
331#else
332template <class _Tp>
333#endif
334struct not_equal_to : __binary_function<_Tp, _Tp, bool> {
335 typedef bool __result_type; // used by valarray
336 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
337 return __x != __y;
338 }
339};
340_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(not_equal_to);
341
342#if _LIBCPP_STD_VER >= 14
343template <>
344struct not_equal_to<void> {
345 template <class _T1, class _T2>
346 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
347 noexcept(noexcept(std::forward<_T1>(__t) != std::forward<_T2>(__u))) //
348 -> decltype(std::forward<_T1>(__t) != std::forward<_T2>(__u)) {
349 return std::forward<_T1>(__t) != std::forward<_T2>(__u);
350 }
351 typedef void is_transparent;
352};
353#endif
354
355template <class _Tp>
356struct less : __binary_function<_Tp, _Tp, bool> {
357 typedef bool __result_type; // used by valarray
358 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
359 return __x < __y;
360 }
361};
362_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(less);
363
364template <class _Tp>
365inline const bool __desugars_to_v<__less_tag, less<_Tp>, _Tp, _Tp> = true;
366
367template <class _Tp>
368inline const bool __desugars_to_v<__totally_ordered_less_tag, less<_Tp>, _Tp, _Tp> = is_integral<_Tp>::value;
369
370#if _LIBCPP_STD_VER >= 14
371template <>
372struct less<void> {
373 template <class _T1, class _T2>
374 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
375 noexcept(noexcept(std::forward<_T1>(__t) < std::forward<_T2>(__u))) //
376 -> decltype(std::forward<_T1>(__t) < std::forward<_T2>(__u)) {
377 return std::forward<_T1>(__t) < std::forward<_T2>(__u);
378 }
379 typedef void is_transparent;
380};
381
382template <class _Tp>
383struct __make_transparent<less<_Tp> > {
384 using type _LIBCPP_NODEBUG = less<>;
385};
386
387template <>
388inline const bool __is_generic_transparent_comparator_v<less<>> = true;
389
390template <class _Tp, class _Up>
391inline const bool __desugars_to_v<__less_tag, less<>, _Tp, _Up> = true;
392
393template <class _Tp>
394inline const bool __desugars_to_v<__totally_ordered_less_tag, less<>, _Tp, _Tp> = is_integral<_Tp>::value;
395#endif
396
397#if _LIBCPP_STD_VER >= 14
398template <class _Tp = void>
399#else
400template <class _Tp>
401#endif
402struct less_equal : __binary_function<_Tp, _Tp, bool> {
403 typedef bool __result_type; // used by valarray
404 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
405 return __x <= __y;
406 }
407};
408_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(less_equal);
409
410#if _LIBCPP_STD_VER >= 14
411template <>
412struct less_equal<void> {
413 template <class _T1, class _T2>
414 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
415 noexcept(noexcept(std::forward<_T1>(__t) <= std::forward<_T2>(__u))) //
416 -> decltype(std::forward<_T1>(__t) <= std::forward<_T2>(__u)) {
417 return std::forward<_T1>(__t) <= std::forward<_T2>(__u);
418 }
419 typedef void is_transparent;
420};
421#endif
422
423#if _LIBCPP_STD_VER >= 14
424template <class _Tp = void>
425#else
426template <class _Tp>
427#endif
428struct greater_equal : __binary_function<_Tp, _Tp, bool> {
429 typedef bool __result_type; // used by valarray
430 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
431 return __x >= __y;
432 }
433};
434_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(greater_equal);
435
436#if _LIBCPP_STD_VER >= 14
437template <>
438struct greater_equal<void> {
439 template <class _T1, class _T2>
440 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
441 noexcept(noexcept(std::forward<_T1>(__t) >=
442 std::forward<_T2>(__u))) -> decltype(std::forward<_T1>(__t) >= std::forward<_T2>(__u)) {
443 return std::forward<_T1>(__t) >= std::forward<_T2>(__u);
444 }
445 typedef void is_transparent;
446};
447#endif
448
449#if _LIBCPP_STD_VER >= 14
450template <class _Tp = void>
451#else
452template <class _Tp>
453#endif
454struct greater : __binary_function<_Tp, _Tp, bool> {
455 typedef bool __result_type; // used by valarray
456 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
457 return __x > __y;
458 }
459};
460_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(greater);
461
462template <class _Tp>
463inline const bool __desugars_to_v<__greater_tag, greater<_Tp>, _Tp, _Tp> = true;
464
465#if _LIBCPP_STD_VER >= 14
466template <>
467struct greater<void> {
468 template <class _T1, class _T2>
469 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
470 noexcept(noexcept(std::forward<_T1>(__t) > std::forward<_T2>(__u))) //
471 -> decltype(std::forward<_T1>(__t) > std::forward<_T2>(__u)) {
472 return std::forward<_T1>(__t) > std::forward<_T2>(__u);
473 }
474 typedef void is_transparent;
475};
476
477template <class _Tp, class _Up>
478inline const bool __desugars_to_v<__greater_tag, greater<>, _Tp, _Up> = true;
479
480template <class _Tp>
481struct __make_transparent<greater<_Tp>> {
482 using type _LIBCPP_NODEBUG = greater<>;
483};
484
485template <>
486inline const bool __is_generic_transparent_comparator_v<greater<>> = true;
487#endif
488
489// Logical operations
490
491#if _LIBCPP_STD_VER >= 14
492template <class _Tp = void>
493#else
494template <class _Tp>
495#endif
496struct logical_and : __binary_function<_Tp, _Tp, bool> {
497 typedef bool __result_type; // used by valarray
498 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
499 return __x && __y;
500 }
501};
502_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_and);
503
504#if _LIBCPP_STD_VER >= 14
505template <>
506struct logical_and<void> {
507 template <class _T1, class _T2>
508 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
509 noexcept(noexcept(std::forward<_T1>(__t) && std::forward<_T2>(__u))) //
510 -> decltype(std::forward<_T1>(__t) && std::forward<_T2>(__u)) {
511 return std::forward<_T1>(__t) && std::forward<_T2>(__u);
512 }
513 typedef void is_transparent;
514};
515#endif
516
517#if _LIBCPP_STD_VER >= 14
518template <class _Tp = void>
519#else
520template <class _Tp>
521#endif
522struct logical_not : __unary_function<_Tp, bool> {
523 typedef bool __result_type; // used by valarray
524 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x) const { return !__x; }
525};
526_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_not);
527
528#if _LIBCPP_STD_VER >= 14
529template <>
530struct logical_not<void> {
531 template <class _Tp>
532 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_Tp&& __x) const
533 noexcept(noexcept(!std::forward<_Tp>(__x))) //
534 -> decltype(!std::forward<_Tp>(__x)) {
535 return !std::forward<_Tp>(__x);
536 }
537 typedef void is_transparent;
538};
539#endif
540
541#if _LIBCPP_STD_VER >= 14
542template <class _Tp = void>
543#else
544template <class _Tp>
545#endif
546struct logical_or : __binary_function<_Tp, _Tp, bool> {
547 typedef bool __result_type; // used by valarray
548 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
549 return __x || __y;
550 }
551};
552_LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_or);
553
554#if _LIBCPP_STD_VER >= 14
555template <>
556struct logical_or<void> {
557 template <class _T1, class _T2>
558 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
559 noexcept(noexcept(std::forward<_T1>(__t) || std::forward<_T2>(__u))) //
560 -> decltype(std::forward<_T1>(__t) || std::forward<_T2>(__u)) {
561 return std::forward<_T1>(__t) || std::forward<_T2>(__u);
562 }
563 typedef void is_transparent;
564};
565#endif
566
567_LIBCPP_END_NAMESPACE_STD
568
569#endif // _LIBCPP___FUNCTIONAL_OPERATIONS_H
570