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_OPERATIONS_H
11 #define _LIBCPP___FUNCTIONAL_OPERATIONS_H
14 #include <__functional/binary_function.h>
15 #include <__functional/unary_function.h>
16 #include <__type_traits/desugars_to.h>
17 #include <__type_traits/is_integral.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 // Arithmetic operations
28 #if _LIBCPP_STD_VER >= 14
29 template <class _Tp
= void>
33 struct _LIBCPP_TEMPLATE_VIS plus
: __binary_function
<_Tp
, _Tp
, _Tp
> {
34 typedef _Tp __result_type
; // used by valarray
35 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp
operator()(const _Tp
& __x
, const _Tp
& __y
) const {
39 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(plus
);
41 // The non-transparent std::plus specialization is only equivalent to a raw plus
42 // operator when we don't perform an implicit conversion when calling it.
44 inline const bool __desugars_to_v
<__plus_tag
, plus
<_Tp
>, _Tp
, _Tp
> = true;
46 template <class _Tp
, class _Up
>
47 inline const bool __desugars_to_v
<__plus_tag
, plus
<void>, _Tp
, _Up
> = true;
49 #if _LIBCPP_STD_VER >= 14
51 struct _LIBCPP_TEMPLATE_VIS plus
<void> {
52 template <class _T1
, class _T2
>
53 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
auto operator()(_T1
&& __t
, _T2
&& __u
) const
54 noexcept(noexcept(std::forward
<_T1
>(__t
) + std::forward
<_T2
>(__u
))) //
55 -> decltype(std::forward
<_T1
>(__t
) + std::forward
<_T2
>(__u
)) {
56 return std::forward
<_T1
>(__t
) + std::forward
<_T2
>(__u
);
58 typedef void is_transparent
;
62 #if _LIBCPP_STD_VER >= 14
63 template <class _Tp
= void>
67 struct _LIBCPP_TEMPLATE_VIS minus
: __binary_function
<_Tp
, _Tp
, _Tp
> {
68 typedef _Tp __result_type
; // used by valarray
69 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp
operator()(const _Tp
& __x
, const _Tp
& __y
) const {
73 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(minus
);
75 #if _LIBCPP_STD_VER >= 14
77 struct _LIBCPP_TEMPLATE_VIS minus
<void> {
78 template <class _T1
, class _T2
>
79 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
auto operator()(_T1
&& __t
, _T2
&& __u
) const
80 noexcept(noexcept(std::forward
<_T1
>(__t
) - std::forward
<_T2
>(__u
))) //
81 -> decltype(std::forward
<_T1
>(__t
) - std::forward
<_T2
>(__u
)) {
82 return std::forward
<_T1
>(__t
) - std::forward
<_T2
>(__u
);
84 typedef void is_transparent
;
88 #if _LIBCPP_STD_VER >= 14
89 template <class _Tp
= void>
93 struct _LIBCPP_TEMPLATE_VIS multiplies
: __binary_function
<_Tp
, _Tp
, _Tp
> {
94 typedef _Tp __result_type
; // used by valarray
95 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp
operator()(const _Tp
& __x
, const _Tp
& __y
) const {
99 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(multiplies
);
101 #if _LIBCPP_STD_VER >= 14
103 struct _LIBCPP_TEMPLATE_VIS multiplies
<void> {
104 template <class _T1
, class _T2
>
105 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
auto operator()(_T1
&& __t
, _T2
&& __u
) const
106 noexcept(noexcept(std::forward
<_T1
>(__t
) * std::forward
<_T2
>(__u
))) //
107 -> decltype(std::forward
<_T1
>(__t
) * std::forward
<_T2
>(__u
)) {
108 return std::forward
<_T1
>(__t
) * std::forward
<_T2
>(__u
);
110 typedef void is_transparent
;
114 #if _LIBCPP_STD_VER >= 14
115 template <class _Tp
= void>
119 struct _LIBCPP_TEMPLATE_VIS divides
: __binary_function
<_Tp
, _Tp
, _Tp
> {
120 typedef _Tp __result_type
; // used by valarray
121 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp
operator()(const _Tp
& __x
, const _Tp
& __y
) const {
125 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(divides
);
127 #if _LIBCPP_STD_VER >= 14
129 struct _LIBCPP_TEMPLATE_VIS divides
<void> {
130 template <class _T1
, class _T2
>
131 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
auto operator()(_T1
&& __t
, _T2
&& __u
) const
132 noexcept(noexcept(std::forward
<_T1
>(__t
) / std::forward
<_T2
>(__u
))) //
133 -> decltype(std::forward
<_T1
>(__t
) / std::forward
<_T2
>(__u
)) {
134 return std::forward
<_T1
>(__t
) / std::forward
<_T2
>(__u
);
136 typedef void is_transparent
;
140 #if _LIBCPP_STD_VER >= 14
141 template <class _Tp
= void>
145 struct _LIBCPP_TEMPLATE_VIS modulus
: __binary_function
<_Tp
, _Tp
, _Tp
> {
146 typedef _Tp __result_type
; // used by valarray
147 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp
operator()(const _Tp
& __x
, const _Tp
& __y
) const {
151 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(modulus
);
153 #if _LIBCPP_STD_VER >= 14
155 struct _LIBCPP_TEMPLATE_VIS modulus
<void> {
156 template <class _T1
, class _T2
>
157 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
auto operator()(_T1
&& __t
, _T2
&& __u
) const
158 noexcept(noexcept(std::forward
<_T1
>(__t
) % std::forward
<_T2
>(__u
))) //
159 -> decltype(std::forward
<_T1
>(__t
) % std::forward
<_T2
>(__u
)) {
160 return std::forward
<_T1
>(__t
) % std::forward
<_T2
>(__u
);
162 typedef void is_transparent
;
166 #if _LIBCPP_STD_VER >= 14
167 template <class _Tp
= void>
171 struct _LIBCPP_TEMPLATE_VIS negate
: __unary_function
<_Tp
, _Tp
> {
172 typedef _Tp __result_type
; // used by valarray
173 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp
operator()(const _Tp
& __x
) const { return -__x
; }
175 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(negate
);
177 #if _LIBCPP_STD_VER >= 14
179 struct _LIBCPP_TEMPLATE_VIS negate
<void> {
181 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
auto operator()(_Tp
&& __x
) const
182 noexcept(noexcept(-std::forward
<_Tp
>(__x
))) //
183 -> decltype(-std::forward
<_Tp
>(__x
)) {
184 return -std::forward
<_Tp
>(__x
);
186 typedef void is_transparent
;
190 // Bitwise operations
192 #if _LIBCPP_STD_VER >= 14
193 template <class _Tp
= void>
197 struct _LIBCPP_TEMPLATE_VIS bit_and
: __binary_function
<_Tp
, _Tp
, _Tp
> {
198 typedef _Tp __result_type
; // used by valarray
199 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp
operator()(const _Tp
& __x
, const _Tp
& __y
) const {
203 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_and
);
205 #if _LIBCPP_STD_VER >= 14
207 struct _LIBCPP_TEMPLATE_VIS bit_and
<void> {
208 template <class _T1
, class _T2
>
209 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
auto operator()(_T1
&& __t
, _T2
&& __u
) const
210 noexcept(noexcept(std::forward
<_T1
>(__t
) &
211 std::forward
<_T2
>(__u
))) -> decltype(std::forward
<_T1
>(__t
) & std::forward
<_T2
>(__u
)) {
212 return std::forward
<_T1
>(__t
) & std::forward
<_T2
>(__u
);
214 typedef void is_transparent
;
218 #if _LIBCPP_STD_VER >= 14
219 template <class _Tp
= void>
220 struct _LIBCPP_TEMPLATE_VIS bit_not
: __unary_function
<_Tp
, _Tp
> {
221 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp
operator()(const _Tp
& __x
) const { return ~__x
; }
223 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_not
);
226 struct _LIBCPP_TEMPLATE_VIS bit_not
<void> {
228 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
auto operator()(_Tp
&& __x
) const
229 noexcept(noexcept(~std::forward
<_Tp
>(__x
))) //
230 -> decltype(~std::forward
<_Tp
>(__x
)) {
231 return ~std::forward
<_Tp
>(__x
);
233 typedef void is_transparent
;
237 #if _LIBCPP_STD_VER >= 14
238 template <class _Tp
= void>
242 struct _LIBCPP_TEMPLATE_VIS bit_or
: __binary_function
<_Tp
, _Tp
, _Tp
> {
243 typedef _Tp __result_type
; // used by valarray
244 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp
operator()(const _Tp
& __x
, const _Tp
& __y
) const {
248 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_or
);
250 #if _LIBCPP_STD_VER >= 14
252 struct _LIBCPP_TEMPLATE_VIS bit_or
<void> {
253 template <class _T1
, class _T2
>
254 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
auto operator()(_T1
&& __t
, _T2
&& __u
) const
255 noexcept(noexcept(std::forward
<_T1
>(__t
) | std::forward
<_T2
>(__u
))) //
256 -> decltype(std::forward
<_T1
>(__t
) | std::forward
<_T2
>(__u
)) {
257 return std::forward
<_T1
>(__t
) | std::forward
<_T2
>(__u
);
259 typedef void is_transparent
;
263 #if _LIBCPP_STD_VER >= 14
264 template <class _Tp
= void>
268 struct _LIBCPP_TEMPLATE_VIS bit_xor
: __binary_function
<_Tp
, _Tp
, _Tp
> {
269 typedef _Tp __result_type
; // used by valarray
270 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp
operator()(const _Tp
& __x
, const _Tp
& __y
) const {
274 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_xor
);
276 #if _LIBCPP_STD_VER >= 14
278 struct _LIBCPP_TEMPLATE_VIS bit_xor
<void> {
279 template <class _T1
, class _T2
>
280 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
auto operator()(_T1
&& __t
, _T2
&& __u
) const
281 noexcept(noexcept(std::forward
<_T1
>(__t
) ^ std::forward
<_T2
>(__u
))) //
282 -> decltype(std::forward
<_T1
>(__t
) ^ std::forward
<_T2
>(__u
)) {
283 return std::forward
<_T1
>(__t
) ^ std::forward
<_T2
>(__u
);
285 typedef void is_transparent
;
289 // Comparison operations
291 #if _LIBCPP_STD_VER >= 14
292 template <class _Tp
= void>
296 struct _LIBCPP_TEMPLATE_VIS equal_to
: __binary_function
<_Tp
, _Tp
, bool> {
297 typedef bool __result_type
; // used by valarray
298 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
bool operator()(const _Tp
& __x
, const _Tp
& __y
) const {
302 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(equal_to
);
304 #if _LIBCPP_STD_VER >= 14
306 struct _LIBCPP_TEMPLATE_VIS equal_to
<void> {
307 template <class _T1
, class _T2
>
308 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
auto operator()(_T1
&& __t
, _T2
&& __u
) const
309 noexcept(noexcept(std::forward
<_T1
>(__t
) == std::forward
<_T2
>(__u
))) //
310 -> decltype(std::forward
<_T1
>(__t
) == std::forward
<_T2
>(__u
)) {
311 return std::forward
<_T1
>(__t
) == std::forward
<_T2
>(__u
);
313 typedef void is_transparent
;
317 // The non-transparent std::equal_to specialization is only equivalent to a raw equality
318 // comparison when we don't perform an implicit conversion when calling it.
320 inline const bool __desugars_to_v
<__equal_tag
, equal_to
<_Tp
>, _Tp
, _Tp
> = true;
322 // In the transparent case, we do not enforce that
323 template <class _Tp
, class _Up
>
324 inline const bool __desugars_to_v
<__equal_tag
, equal_to
<void>, _Tp
, _Up
> = true;
326 #if _LIBCPP_STD_VER >= 14
327 template <class _Tp
= void>
331 struct _LIBCPP_TEMPLATE_VIS not_equal_to
: __binary_function
<_Tp
, _Tp
, bool> {
332 typedef bool __result_type
; // used by valarray
333 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
bool operator()(const _Tp
& __x
, const _Tp
& __y
) const {
337 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(not_equal_to
);
339 #if _LIBCPP_STD_VER >= 14
341 struct _LIBCPP_TEMPLATE_VIS not_equal_to
<void> {
342 template <class _T1
, class _T2
>
343 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
auto operator()(_T1
&& __t
, _T2
&& __u
) const
344 noexcept(noexcept(std::forward
<_T1
>(__t
) != std::forward
<_T2
>(__u
))) //
345 -> decltype(std::forward
<_T1
>(__t
) != std::forward
<_T2
>(__u
)) {
346 return std::forward
<_T1
>(__t
) != std::forward
<_T2
>(__u
);
348 typedef void is_transparent
;
352 #if _LIBCPP_STD_VER >= 14
353 template <class _Tp
= void>
357 struct _LIBCPP_TEMPLATE_VIS less
: __binary_function
<_Tp
, _Tp
, bool> {
358 typedef bool __result_type
; // used by valarray
359 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
bool operator()(const _Tp
& __x
, const _Tp
& __y
) const {
363 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(less
);
366 inline const bool __desugars_to_v
<__less_tag
, less
<_Tp
>, _Tp
, _Tp
> = true;
369 inline const bool __desugars_to_v
<__totally_ordered_less_tag
, less
<_Tp
>, _Tp
, _Tp
> = is_integral
<_Tp
>::value
;
371 #if _LIBCPP_STD_VER >= 14
373 struct _LIBCPP_TEMPLATE_VIS less
<void> {
374 template <class _T1
, class _T2
>
375 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
auto operator()(_T1
&& __t
, _T2
&& __u
) const
376 noexcept(noexcept(std::forward
<_T1
>(__t
) < std::forward
<_T2
>(__u
))) //
377 -> decltype(std::forward
<_T1
>(__t
) < std::forward
<_T2
>(__u
)) {
378 return std::forward
<_T1
>(__t
) < std::forward
<_T2
>(__u
);
380 typedef void is_transparent
;
383 template <class _Tp
, class _Up
>
384 inline const bool __desugars_to_v
<__less_tag
, less
<>, _Tp
, _Up
> = true;
387 inline const bool __desugars_to_v
<__totally_ordered_less_tag
, less
<>, _Tp
, _Tp
> = is_integral
<_Tp
>::value
;
390 #if _LIBCPP_STD_VER >= 14
391 template <class _Tp
= void>
395 struct _LIBCPP_TEMPLATE_VIS less_equal
: __binary_function
<_Tp
, _Tp
, bool> {
396 typedef bool __result_type
; // used by valarray
397 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
bool operator()(const _Tp
& __x
, const _Tp
& __y
) const {
401 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(less_equal
);
403 #if _LIBCPP_STD_VER >= 14
405 struct _LIBCPP_TEMPLATE_VIS less_equal
<void> {
406 template <class _T1
, class _T2
>
407 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
auto operator()(_T1
&& __t
, _T2
&& __u
) const
408 noexcept(noexcept(std::forward
<_T1
>(__t
) <= std::forward
<_T2
>(__u
))) //
409 -> decltype(std::forward
<_T1
>(__t
) <= std::forward
<_T2
>(__u
)) {
410 return std::forward
<_T1
>(__t
) <= std::forward
<_T2
>(__u
);
412 typedef void is_transparent
;
416 #if _LIBCPP_STD_VER >= 14
417 template <class _Tp
= void>
421 struct _LIBCPP_TEMPLATE_VIS greater_equal
: __binary_function
<_Tp
, _Tp
, bool> {
422 typedef bool __result_type
; // used by valarray
423 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
bool operator()(const _Tp
& __x
, const _Tp
& __y
) const {
427 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(greater_equal
);
429 #if _LIBCPP_STD_VER >= 14
431 struct _LIBCPP_TEMPLATE_VIS greater_equal
<void> {
432 template <class _T1
, class _T2
>
433 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
auto operator()(_T1
&& __t
, _T2
&& __u
) const
434 noexcept(noexcept(std::forward
<_T1
>(__t
) >=
435 std::forward
<_T2
>(__u
))) -> decltype(std::forward
<_T1
>(__t
) >= std::forward
<_T2
>(__u
)) {
436 return std::forward
<_T1
>(__t
) >= std::forward
<_T2
>(__u
);
438 typedef void is_transparent
;
442 #if _LIBCPP_STD_VER >= 14
443 template <class _Tp
= void>
447 struct _LIBCPP_TEMPLATE_VIS greater
: __binary_function
<_Tp
, _Tp
, bool> {
448 typedef bool __result_type
; // used by valarray
449 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
bool operator()(const _Tp
& __x
, const _Tp
& __y
) const {
453 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(greater
);
456 inline const bool __desugars_to_v
<__greater_tag
, greater
<_Tp
>, _Tp
, _Tp
> = true;
458 #if _LIBCPP_STD_VER >= 14
460 struct _LIBCPP_TEMPLATE_VIS greater
<void> {
461 template <class _T1
, class _T2
>
462 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
auto operator()(_T1
&& __t
, _T2
&& __u
) const
463 noexcept(noexcept(std::forward
<_T1
>(__t
) > std::forward
<_T2
>(__u
))) //
464 -> decltype(std::forward
<_T1
>(__t
) > std::forward
<_T2
>(__u
)) {
465 return std::forward
<_T1
>(__t
) > std::forward
<_T2
>(__u
);
467 typedef void is_transparent
;
470 template <class _Tp
, class _Up
>
471 inline const bool __desugars_to_v
<__greater_tag
, greater
<>, _Tp
, _Up
> = true;
474 // Logical operations
476 #if _LIBCPP_STD_VER >= 14
477 template <class _Tp
= void>
481 struct _LIBCPP_TEMPLATE_VIS logical_and
: __binary_function
<_Tp
, _Tp
, bool> {
482 typedef bool __result_type
; // used by valarray
483 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
bool operator()(const _Tp
& __x
, const _Tp
& __y
) const {
487 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_and
);
489 #if _LIBCPP_STD_VER >= 14
491 struct _LIBCPP_TEMPLATE_VIS logical_and
<void> {
492 template <class _T1
, class _T2
>
493 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
auto operator()(_T1
&& __t
, _T2
&& __u
) const
494 noexcept(noexcept(std::forward
<_T1
>(__t
) && std::forward
<_T2
>(__u
))) //
495 -> decltype(std::forward
<_T1
>(__t
) && std::forward
<_T2
>(__u
)) {
496 return std::forward
<_T1
>(__t
) && std::forward
<_T2
>(__u
);
498 typedef void is_transparent
;
502 #if _LIBCPP_STD_VER >= 14
503 template <class _Tp
= void>
507 struct _LIBCPP_TEMPLATE_VIS logical_not
: __unary_function
<_Tp
, bool> {
508 typedef bool __result_type
; // used by valarray
509 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
bool operator()(const _Tp
& __x
) const { return !__x
; }
511 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_not
);
513 #if _LIBCPP_STD_VER >= 14
515 struct _LIBCPP_TEMPLATE_VIS logical_not
<void> {
517 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
auto operator()(_Tp
&& __x
) const
518 noexcept(noexcept(!std::forward
<_Tp
>(__x
))) //
519 -> decltype(!std::forward
<_Tp
>(__x
)) {
520 return !std::forward
<_Tp
>(__x
);
522 typedef void is_transparent
;
526 #if _LIBCPP_STD_VER >= 14
527 template <class _Tp
= void>
531 struct _LIBCPP_TEMPLATE_VIS logical_or
: __binary_function
<_Tp
, _Tp
, bool> {
532 typedef bool __result_type
; // used by valarray
533 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
bool operator()(const _Tp
& __x
, const _Tp
& __y
) const {
537 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_or
);
539 #if _LIBCPP_STD_VER >= 14
541 struct _LIBCPP_TEMPLATE_VIS logical_or
<void> {
542 template <class _T1
, class _T2
>
543 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI
auto operator()(_T1
&& __t
, _T2
&& __u
) const
544 noexcept(noexcept(std::forward
<_T1
>(__t
) || std::forward
<_T2
>(__u
))) //
545 -> decltype(std::forward
<_T1
>(__t
) || std::forward
<_T2
>(__u
)) {
546 return std::forward
<_T1
>(__t
) || std::forward
<_T2
>(__u
);
548 typedef void is_transparent
;
552 _LIBCPP_END_NAMESPACE_STD
554 #endif // _LIBCPP___FUNCTIONAL_OPERATIONS_H