[Clang] Don't form a type constraint if the concept is invalid (#122065)
[llvm-project.git] / libcxx / include / __cxx03 / __functional / operations.h
blobddbe71bdc8b68b2111341721696a94b51ab9fcde
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 //===----------------------------------------------------------------------===//
10 #ifndef _LIBCPP___CXX03___FUNCTIONAL_OPERATIONS_H
11 #define _LIBCPP___CXX03___FUNCTIONAL_OPERATIONS_H
13 #include <__cxx03/__config>
14 #include <__cxx03/__functional/binary_function.h>
15 #include <__cxx03/__functional/unary_function.h>
16 #include <__cxx03/__type_traits/desugars_to.h>
17 #include <__cxx03/__utility/forward.h>
19 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
20 # pragma GCC system_header
21 #endif
23 _LIBCPP_BEGIN_NAMESPACE_STD
25 // Arithmetic operations
27 #if _LIBCPP_STD_VER >= 14
28 template <class _Tp = void>
29 #else
30 template <class _Tp>
31 #endif
32 struct _LIBCPP_TEMPLATE_VIS plus : __binary_function<_Tp, _Tp, _Tp> {
33 typedef _Tp __result_type; // used by valarray
34 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
35 return __x + __y;
38 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(plus);
40 // The non-transparent std::plus specialization is only equivalent to a raw plus
41 // operator when we don't perform an implicit conversion when calling it.
42 template <class _Tp>
43 inline const bool __desugars_to_v<__plus_tag, plus<_Tp>, _Tp, _Tp> = true;
45 template <class _Tp, class _Up>
46 inline const bool __desugars_to_v<__plus_tag, plus<void>, _Tp, _Up> = true;
48 #if _LIBCPP_STD_VER >= 14
49 template <>
50 struct _LIBCPP_TEMPLATE_VIS plus<void> {
51 template <class _T1, class _T2>
52 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
53 noexcept(noexcept(std::forward<_T1>(__t) + std::forward<_T2>(__u))) //
54 -> decltype(std::forward<_T1>(__t) + std::forward<_T2>(__u)) {
55 return std::forward<_T1>(__t) + std::forward<_T2>(__u);
57 typedef void is_transparent;
59 #endif
61 #if _LIBCPP_STD_VER >= 14
62 template <class _Tp = void>
63 #else
64 template <class _Tp>
65 #endif
66 struct _LIBCPP_TEMPLATE_VIS minus : __binary_function<_Tp, _Tp, _Tp> {
67 typedef _Tp __result_type; // used by valarray
68 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
69 return __x - __y;
72 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(minus);
74 #if _LIBCPP_STD_VER >= 14
75 template <>
76 struct _LIBCPP_TEMPLATE_VIS minus<void> {
77 template <class _T1, class _T2>
78 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
79 noexcept(noexcept(std::forward<_T1>(__t) - std::forward<_T2>(__u))) //
80 -> decltype(std::forward<_T1>(__t) - std::forward<_T2>(__u)) {
81 return std::forward<_T1>(__t) - std::forward<_T2>(__u);
83 typedef void is_transparent;
85 #endif
87 #if _LIBCPP_STD_VER >= 14
88 template <class _Tp = void>
89 #else
90 template <class _Tp>
91 #endif
92 struct _LIBCPP_TEMPLATE_VIS multiplies : __binary_function<_Tp, _Tp, _Tp> {
93 typedef _Tp __result_type; // used by valarray
94 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
95 return __x * __y;
98 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(multiplies);
100 #if _LIBCPP_STD_VER >= 14
101 template <>
102 struct _LIBCPP_TEMPLATE_VIS multiplies<void> {
103 template <class _T1, class _T2>
104 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
105 noexcept(noexcept(std::forward<_T1>(__t) * std::forward<_T2>(__u))) //
106 -> decltype(std::forward<_T1>(__t) * std::forward<_T2>(__u)) {
107 return std::forward<_T1>(__t) * std::forward<_T2>(__u);
109 typedef void is_transparent;
111 #endif
113 #if _LIBCPP_STD_VER >= 14
114 template <class _Tp = void>
115 #else
116 template <class _Tp>
117 #endif
118 struct _LIBCPP_TEMPLATE_VIS divides : __binary_function<_Tp, _Tp, _Tp> {
119 typedef _Tp __result_type; // used by valarray
120 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
121 return __x / __y;
124 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(divides);
126 #if _LIBCPP_STD_VER >= 14
127 template <>
128 struct _LIBCPP_TEMPLATE_VIS divides<void> {
129 template <class _T1, class _T2>
130 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
131 noexcept(noexcept(std::forward<_T1>(__t) / std::forward<_T2>(__u))) //
132 -> decltype(std::forward<_T1>(__t) / std::forward<_T2>(__u)) {
133 return std::forward<_T1>(__t) / std::forward<_T2>(__u);
135 typedef void is_transparent;
137 #endif
139 #if _LIBCPP_STD_VER >= 14
140 template <class _Tp = void>
141 #else
142 template <class _Tp>
143 #endif
144 struct _LIBCPP_TEMPLATE_VIS modulus : __binary_function<_Tp, _Tp, _Tp> {
145 typedef _Tp __result_type; // used by valarray
146 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
147 return __x % __y;
150 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(modulus);
152 #if _LIBCPP_STD_VER >= 14
153 template <>
154 struct _LIBCPP_TEMPLATE_VIS modulus<void> {
155 template <class _T1, class _T2>
156 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
157 noexcept(noexcept(std::forward<_T1>(__t) % std::forward<_T2>(__u))) //
158 -> decltype(std::forward<_T1>(__t) % std::forward<_T2>(__u)) {
159 return std::forward<_T1>(__t) % std::forward<_T2>(__u);
161 typedef void is_transparent;
163 #endif
165 #if _LIBCPP_STD_VER >= 14
166 template <class _Tp = void>
167 #else
168 template <class _Tp>
169 #endif
170 struct _LIBCPP_TEMPLATE_VIS negate : __unary_function<_Tp, _Tp> {
171 typedef _Tp __result_type; // used by valarray
172 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return -__x; }
174 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(negate);
176 #if _LIBCPP_STD_VER >= 14
177 template <>
178 struct _LIBCPP_TEMPLATE_VIS negate<void> {
179 template <class _Tp>
180 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_Tp&& __x) const
181 noexcept(noexcept(-std::forward<_Tp>(__x))) //
182 -> decltype(-std::forward<_Tp>(__x)) {
183 return -std::forward<_Tp>(__x);
185 typedef void is_transparent;
187 #endif
189 // Bitwise operations
191 #if _LIBCPP_STD_VER >= 14
192 template <class _Tp = void>
193 #else
194 template <class _Tp>
195 #endif
196 struct _LIBCPP_TEMPLATE_VIS bit_and : __binary_function<_Tp, _Tp, _Tp> {
197 typedef _Tp __result_type; // used by valarray
198 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
199 return __x & __y;
202 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_and);
204 #if _LIBCPP_STD_VER >= 14
205 template <>
206 struct _LIBCPP_TEMPLATE_VIS bit_and<void> {
207 template <class _T1, class _T2>
208 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
209 noexcept(noexcept(std::forward<_T1>(__t) &
210 std::forward<_T2>(__u))) -> decltype(std::forward<_T1>(__t) & std::forward<_T2>(__u)) {
211 return std::forward<_T1>(__t) & std::forward<_T2>(__u);
213 typedef void is_transparent;
215 #endif
217 #if _LIBCPP_STD_VER >= 14
218 template <class _Tp = void>
219 struct _LIBCPP_TEMPLATE_VIS bit_not : __unary_function<_Tp, _Tp> {
220 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return ~__x; }
222 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_not);
224 template <>
225 struct _LIBCPP_TEMPLATE_VIS bit_not<void> {
226 template <class _Tp>
227 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_Tp&& __x) const
228 noexcept(noexcept(~std::forward<_Tp>(__x))) //
229 -> decltype(~std::forward<_Tp>(__x)) {
230 return ~std::forward<_Tp>(__x);
232 typedef void is_transparent;
234 #endif
236 #if _LIBCPP_STD_VER >= 14
237 template <class _Tp = void>
238 #else
239 template <class _Tp>
240 #endif
241 struct _LIBCPP_TEMPLATE_VIS bit_or : __binary_function<_Tp, _Tp, _Tp> {
242 typedef _Tp __result_type; // used by valarray
243 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
244 return __x | __y;
247 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_or);
249 #if _LIBCPP_STD_VER >= 14
250 template <>
251 struct _LIBCPP_TEMPLATE_VIS bit_or<void> {
252 template <class _T1, class _T2>
253 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
254 noexcept(noexcept(std::forward<_T1>(__t) | std::forward<_T2>(__u))) //
255 -> decltype(std::forward<_T1>(__t) | std::forward<_T2>(__u)) {
256 return std::forward<_T1>(__t) | std::forward<_T2>(__u);
258 typedef void is_transparent;
260 #endif
262 #if _LIBCPP_STD_VER >= 14
263 template <class _Tp = void>
264 #else
265 template <class _Tp>
266 #endif
267 struct _LIBCPP_TEMPLATE_VIS bit_xor : __binary_function<_Tp, _Tp, _Tp> {
268 typedef _Tp __result_type; // used by valarray
269 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
270 return __x ^ __y;
273 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_xor);
275 #if _LIBCPP_STD_VER >= 14
276 template <>
277 struct _LIBCPP_TEMPLATE_VIS bit_xor<void> {
278 template <class _T1, class _T2>
279 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
280 noexcept(noexcept(std::forward<_T1>(__t) ^ std::forward<_T2>(__u))) //
281 -> decltype(std::forward<_T1>(__t) ^ std::forward<_T2>(__u)) {
282 return std::forward<_T1>(__t) ^ std::forward<_T2>(__u);
284 typedef void is_transparent;
286 #endif
288 // Comparison operations
290 #if _LIBCPP_STD_VER >= 14
291 template <class _Tp = void>
292 #else
293 template <class _Tp>
294 #endif
295 struct _LIBCPP_TEMPLATE_VIS equal_to : __binary_function<_Tp, _Tp, bool> {
296 typedef bool __result_type; // used by valarray
297 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
298 return __x == __y;
301 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(equal_to);
303 #if _LIBCPP_STD_VER >= 14
304 template <>
305 struct _LIBCPP_TEMPLATE_VIS equal_to<void> {
306 template <class _T1, class _T2>
307 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
308 noexcept(noexcept(std::forward<_T1>(__t) == std::forward<_T2>(__u))) //
309 -> decltype(std::forward<_T1>(__t) == std::forward<_T2>(__u)) {
310 return std::forward<_T1>(__t) == std::forward<_T2>(__u);
312 typedef void is_transparent;
314 #endif
316 // The non-transparent std::equal_to specialization is only equivalent to a raw equality
317 // comparison when we don't perform an implicit conversion when calling it.
318 template <class _Tp>
319 inline const bool __desugars_to_v<__equal_tag, equal_to<_Tp>, _Tp, _Tp> = true;
321 // In the transparent case, we do not enforce that
322 template <class _Tp, class _Up>
323 inline const bool __desugars_to_v<__equal_tag, equal_to<void>, _Tp, _Up> = true;
325 #if _LIBCPP_STD_VER >= 14
326 template <class _Tp = void>
327 #else
328 template <class _Tp>
329 #endif
330 struct _LIBCPP_TEMPLATE_VIS not_equal_to : __binary_function<_Tp, _Tp, bool> {
331 typedef bool __result_type; // used by valarray
332 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
333 return __x != __y;
336 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(not_equal_to);
338 #if _LIBCPP_STD_VER >= 14
339 template <>
340 struct _LIBCPP_TEMPLATE_VIS not_equal_to<void> {
341 template <class _T1, class _T2>
342 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
343 noexcept(noexcept(std::forward<_T1>(__t) != std::forward<_T2>(__u))) //
344 -> decltype(std::forward<_T1>(__t) != std::forward<_T2>(__u)) {
345 return std::forward<_T1>(__t) != std::forward<_T2>(__u);
347 typedef void is_transparent;
349 #endif
351 #if _LIBCPP_STD_VER >= 14
352 template <class _Tp = void>
353 #else
354 template <class _Tp>
355 #endif
356 struct _LIBCPP_TEMPLATE_VIS 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;
362 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(less);
364 template <class _Tp>
365 inline const bool __desugars_to_v<__less_tag, less<_Tp>, _Tp, _Tp> = true;
367 #if _LIBCPP_STD_VER >= 14
368 template <>
369 struct _LIBCPP_TEMPLATE_VIS less<void> {
370 template <class _T1, class _T2>
371 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
372 noexcept(noexcept(std::forward<_T1>(__t) < std::forward<_T2>(__u))) //
373 -> decltype(std::forward<_T1>(__t) < std::forward<_T2>(__u)) {
374 return std::forward<_T1>(__t) < std::forward<_T2>(__u);
376 typedef void is_transparent;
379 template <class _Tp>
380 inline const bool __desugars_to_v<__less_tag, less<>, _Tp, _Tp> = true;
381 #endif
383 #if _LIBCPP_STD_VER >= 14
384 template <class _Tp = void>
385 #else
386 template <class _Tp>
387 #endif
388 struct _LIBCPP_TEMPLATE_VIS less_equal : __binary_function<_Tp, _Tp, bool> {
389 typedef bool __result_type; // used by valarray
390 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
391 return __x <= __y;
394 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(less_equal);
396 #if _LIBCPP_STD_VER >= 14
397 template <>
398 struct _LIBCPP_TEMPLATE_VIS less_equal<void> {
399 template <class _T1, class _T2>
400 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
401 noexcept(noexcept(std::forward<_T1>(__t) <= std::forward<_T2>(__u))) //
402 -> decltype(std::forward<_T1>(__t) <= std::forward<_T2>(__u)) {
403 return std::forward<_T1>(__t) <= std::forward<_T2>(__u);
405 typedef void is_transparent;
407 #endif
409 #if _LIBCPP_STD_VER >= 14
410 template <class _Tp = void>
411 #else
412 template <class _Tp>
413 #endif
414 struct _LIBCPP_TEMPLATE_VIS greater_equal : __binary_function<_Tp, _Tp, bool> {
415 typedef bool __result_type; // used by valarray
416 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
417 return __x >= __y;
420 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(greater_equal);
422 #if _LIBCPP_STD_VER >= 14
423 template <>
424 struct _LIBCPP_TEMPLATE_VIS greater_equal<void> {
425 template <class _T1, class _T2>
426 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
427 noexcept(noexcept(std::forward<_T1>(__t) >=
428 std::forward<_T2>(__u))) -> decltype(std::forward<_T1>(__t) >= std::forward<_T2>(__u)) {
429 return std::forward<_T1>(__t) >= std::forward<_T2>(__u);
431 typedef void is_transparent;
433 #endif
435 #if _LIBCPP_STD_VER >= 14
436 template <class _Tp = void>
437 #else
438 template <class _Tp>
439 #endif
440 struct _LIBCPP_TEMPLATE_VIS greater : __binary_function<_Tp, _Tp, bool> {
441 typedef bool __result_type; // used by valarray
442 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
443 return __x > __y;
446 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(greater);
448 #if _LIBCPP_STD_VER >= 14
449 template <>
450 struct _LIBCPP_TEMPLATE_VIS greater<void> {
451 template <class _T1, class _T2>
452 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
453 noexcept(noexcept(std::forward<_T1>(__t) > std::forward<_T2>(__u))) //
454 -> decltype(std::forward<_T1>(__t) > std::forward<_T2>(__u)) {
455 return std::forward<_T1>(__t) > std::forward<_T2>(__u);
457 typedef void is_transparent;
459 #endif
461 // Logical operations
463 #if _LIBCPP_STD_VER >= 14
464 template <class _Tp = void>
465 #else
466 template <class _Tp>
467 #endif
468 struct _LIBCPP_TEMPLATE_VIS logical_and : __binary_function<_Tp, _Tp, bool> {
469 typedef bool __result_type; // used by valarray
470 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
471 return __x && __y;
474 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_and);
476 #if _LIBCPP_STD_VER >= 14
477 template <>
478 struct _LIBCPP_TEMPLATE_VIS logical_and<void> {
479 template <class _T1, class _T2>
480 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
481 noexcept(noexcept(std::forward<_T1>(__t) && std::forward<_T2>(__u))) //
482 -> decltype(std::forward<_T1>(__t) && std::forward<_T2>(__u)) {
483 return std::forward<_T1>(__t) && std::forward<_T2>(__u);
485 typedef void is_transparent;
487 #endif
489 #if _LIBCPP_STD_VER >= 14
490 template <class _Tp = void>
491 #else
492 template <class _Tp>
493 #endif
494 struct _LIBCPP_TEMPLATE_VIS logical_not : __unary_function<_Tp, bool> {
495 typedef bool __result_type; // used by valarray
496 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x) const { return !__x; }
498 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_not);
500 #if _LIBCPP_STD_VER >= 14
501 template <>
502 struct _LIBCPP_TEMPLATE_VIS logical_not<void> {
503 template <class _Tp>
504 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_Tp&& __x) const
505 noexcept(noexcept(!std::forward<_Tp>(__x))) //
506 -> decltype(!std::forward<_Tp>(__x)) {
507 return !std::forward<_Tp>(__x);
509 typedef void is_transparent;
511 #endif
513 #if _LIBCPP_STD_VER >= 14
514 template <class _Tp = void>
515 #else
516 template <class _Tp>
517 #endif
518 struct _LIBCPP_TEMPLATE_VIS logical_or : __binary_function<_Tp, _Tp, bool> {
519 typedef bool __result_type; // used by valarray
520 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
521 return __x || __y;
524 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_or);
526 #if _LIBCPP_STD_VER >= 14
527 template <>
528 struct _LIBCPP_TEMPLATE_VIS logical_or<void> {
529 template <class _T1, class _T2>
530 _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
531 noexcept(noexcept(std::forward<_T1>(__t) || std::forward<_T2>(__u))) //
532 -> decltype(std::forward<_T1>(__t) || std::forward<_T2>(__u)) {
533 return std::forward<_T1>(__t) || std::forward<_T2>(__u);
535 typedef void is_transparent;
537 #endif
539 _LIBCPP_END_NAMESPACE_STD
541 #endif // _LIBCPP___CXX03___FUNCTIONAL_OPERATIONS_H