Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-03 08:13:52

0001 // -*- C++ -*-
0002 //===----------------------------------------------------------------------===//
0003 //
0004 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
0005 // See https://llvm.org/LICENSE.txt for license information.
0006 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
0007 //
0008 //===----------------------------------------------------------------------===//
0009 
0010 #ifndef _LIBCPP___FUNCTIONAL_OPERATIONS_H
0011 #define _LIBCPP___FUNCTIONAL_OPERATIONS_H
0012 
0013 #include <__config>
0014 #include <__functional/binary_function.h>
0015 #include <__functional/unary_function.h>
0016 #include <__type_traits/desugars_to.h>
0017 #include <__type_traits/is_integral.h>
0018 #include <__utility/forward.h>
0019 
0020 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
0021 #  pragma GCC system_header
0022 #endif
0023 
0024 _LIBCPP_BEGIN_NAMESPACE_STD
0025 
0026 // Arithmetic operations
0027 
0028 #if _LIBCPP_STD_VER >= 14
0029 template <class _Tp = void>
0030 #else
0031 template <class _Tp>
0032 #endif
0033 struct _LIBCPP_TEMPLATE_VIS plus : __binary_function<_Tp, _Tp, _Tp> {
0034   typedef _Tp __result_type; // used by valarray
0035   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
0036     return __x + __y;
0037   }
0038 };
0039 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(plus);
0040 
0041 // The non-transparent std::plus specialization is only equivalent to a raw plus
0042 // operator when we don't perform an implicit conversion when calling it.
0043 template <class _Tp>
0044 inline const bool __desugars_to_v<__plus_tag, plus<_Tp>, _Tp, _Tp> = true;
0045 
0046 template <class _Tp, class _Up>
0047 inline const bool __desugars_to_v<__plus_tag, plus<void>, _Tp, _Up> = true;
0048 
0049 #if _LIBCPP_STD_VER >= 14
0050 template <>
0051 struct _LIBCPP_TEMPLATE_VIS plus<void> {
0052   template <class _T1, class _T2>
0053   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
0054       noexcept(noexcept(std::forward<_T1>(__t) + std::forward<_T2>(__u))) //
0055       -> decltype(std::forward<_T1>(__t) + std::forward<_T2>(__u)) {
0056     return std::forward<_T1>(__t) + std::forward<_T2>(__u);
0057   }
0058   typedef void is_transparent;
0059 };
0060 #endif
0061 
0062 #if _LIBCPP_STD_VER >= 14
0063 template <class _Tp = void>
0064 #else
0065 template <class _Tp>
0066 #endif
0067 struct _LIBCPP_TEMPLATE_VIS minus : __binary_function<_Tp, _Tp, _Tp> {
0068   typedef _Tp __result_type; // used by valarray
0069   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
0070     return __x - __y;
0071   }
0072 };
0073 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(minus);
0074 
0075 #if _LIBCPP_STD_VER >= 14
0076 template <>
0077 struct _LIBCPP_TEMPLATE_VIS minus<void> {
0078   template <class _T1, class _T2>
0079   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
0080       noexcept(noexcept(std::forward<_T1>(__t) - std::forward<_T2>(__u))) //
0081       -> decltype(std::forward<_T1>(__t) - std::forward<_T2>(__u)) {
0082     return std::forward<_T1>(__t) - std::forward<_T2>(__u);
0083   }
0084   typedef void is_transparent;
0085 };
0086 #endif
0087 
0088 #if _LIBCPP_STD_VER >= 14
0089 template <class _Tp = void>
0090 #else
0091 template <class _Tp>
0092 #endif
0093 struct _LIBCPP_TEMPLATE_VIS multiplies : __binary_function<_Tp, _Tp, _Tp> {
0094   typedef _Tp __result_type; // used by valarray
0095   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
0096     return __x * __y;
0097   }
0098 };
0099 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(multiplies);
0100 
0101 #if _LIBCPP_STD_VER >= 14
0102 template <>
0103 struct _LIBCPP_TEMPLATE_VIS multiplies<void> {
0104   template <class _T1, class _T2>
0105   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
0106       noexcept(noexcept(std::forward<_T1>(__t) * std::forward<_T2>(__u))) //
0107       -> decltype(std::forward<_T1>(__t) * std::forward<_T2>(__u)) {
0108     return std::forward<_T1>(__t) * std::forward<_T2>(__u);
0109   }
0110   typedef void is_transparent;
0111 };
0112 #endif
0113 
0114 #if _LIBCPP_STD_VER >= 14
0115 template <class _Tp = void>
0116 #else
0117 template <class _Tp>
0118 #endif
0119 struct _LIBCPP_TEMPLATE_VIS divides : __binary_function<_Tp, _Tp, _Tp> {
0120   typedef _Tp __result_type; // used by valarray
0121   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
0122     return __x / __y;
0123   }
0124 };
0125 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(divides);
0126 
0127 #if _LIBCPP_STD_VER >= 14
0128 template <>
0129 struct _LIBCPP_TEMPLATE_VIS divides<void> {
0130   template <class _T1, class _T2>
0131   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
0132       noexcept(noexcept(std::forward<_T1>(__t) / std::forward<_T2>(__u))) //
0133       -> decltype(std::forward<_T1>(__t) / std::forward<_T2>(__u)) {
0134     return std::forward<_T1>(__t) / std::forward<_T2>(__u);
0135   }
0136   typedef void is_transparent;
0137 };
0138 #endif
0139 
0140 #if _LIBCPP_STD_VER >= 14
0141 template <class _Tp = void>
0142 #else
0143 template <class _Tp>
0144 #endif
0145 struct _LIBCPP_TEMPLATE_VIS modulus : __binary_function<_Tp, _Tp, _Tp> {
0146   typedef _Tp __result_type; // used by valarray
0147   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
0148     return __x % __y;
0149   }
0150 };
0151 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(modulus);
0152 
0153 #if _LIBCPP_STD_VER >= 14
0154 template <>
0155 struct _LIBCPP_TEMPLATE_VIS modulus<void> {
0156   template <class _T1, class _T2>
0157   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
0158       noexcept(noexcept(std::forward<_T1>(__t) % std::forward<_T2>(__u))) //
0159       -> decltype(std::forward<_T1>(__t) % std::forward<_T2>(__u)) {
0160     return std::forward<_T1>(__t) % std::forward<_T2>(__u);
0161   }
0162   typedef void is_transparent;
0163 };
0164 #endif
0165 
0166 #if _LIBCPP_STD_VER >= 14
0167 template <class _Tp = void>
0168 #else
0169 template <class _Tp>
0170 #endif
0171 struct _LIBCPP_TEMPLATE_VIS negate : __unary_function<_Tp, _Tp> {
0172   typedef _Tp __result_type; // used by valarray
0173   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return -__x; }
0174 };
0175 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(negate);
0176 
0177 #if _LIBCPP_STD_VER >= 14
0178 template <>
0179 struct _LIBCPP_TEMPLATE_VIS negate<void> {
0180   template <class _Tp>
0181   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_Tp&& __x) const
0182       noexcept(noexcept(-std::forward<_Tp>(__x))) //
0183       -> decltype(-std::forward<_Tp>(__x)) {
0184     return -std::forward<_Tp>(__x);
0185   }
0186   typedef void is_transparent;
0187 };
0188 #endif
0189 
0190 // Bitwise operations
0191 
0192 #if _LIBCPP_STD_VER >= 14
0193 template <class _Tp = void>
0194 #else
0195 template <class _Tp>
0196 #endif
0197 struct _LIBCPP_TEMPLATE_VIS bit_and : __binary_function<_Tp, _Tp, _Tp> {
0198   typedef _Tp __result_type; // used by valarray
0199   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
0200     return __x & __y;
0201   }
0202 };
0203 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_and);
0204 
0205 #if _LIBCPP_STD_VER >= 14
0206 template <>
0207 struct _LIBCPP_TEMPLATE_VIS bit_and<void> {
0208   template <class _T1, class _T2>
0209   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
0210       noexcept(noexcept(std::forward<_T1>(__t) &
0211                         std::forward<_T2>(__u))) -> decltype(std::forward<_T1>(__t) & std::forward<_T2>(__u)) {
0212     return std::forward<_T1>(__t) & std::forward<_T2>(__u);
0213   }
0214   typedef void is_transparent;
0215 };
0216 #endif
0217 
0218 #if _LIBCPP_STD_VER >= 14
0219 template <class _Tp = void>
0220 struct _LIBCPP_TEMPLATE_VIS bit_not : __unary_function<_Tp, _Tp> {
0221   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x) const { return ~__x; }
0222 };
0223 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_not);
0224 
0225 template <>
0226 struct _LIBCPP_TEMPLATE_VIS bit_not<void> {
0227   template <class _Tp>
0228   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_Tp&& __x) const
0229       noexcept(noexcept(~std::forward<_Tp>(__x))) //
0230       -> decltype(~std::forward<_Tp>(__x)) {
0231     return ~std::forward<_Tp>(__x);
0232   }
0233   typedef void is_transparent;
0234 };
0235 #endif
0236 
0237 #if _LIBCPP_STD_VER >= 14
0238 template <class _Tp = void>
0239 #else
0240 template <class _Tp>
0241 #endif
0242 struct _LIBCPP_TEMPLATE_VIS bit_or : __binary_function<_Tp, _Tp, _Tp> {
0243   typedef _Tp __result_type; // used by valarray
0244   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
0245     return __x | __y;
0246   }
0247 };
0248 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_or);
0249 
0250 #if _LIBCPP_STD_VER >= 14
0251 template <>
0252 struct _LIBCPP_TEMPLATE_VIS bit_or<void> {
0253   template <class _T1, class _T2>
0254   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
0255       noexcept(noexcept(std::forward<_T1>(__t) | std::forward<_T2>(__u))) //
0256       -> decltype(std::forward<_T1>(__t) | std::forward<_T2>(__u)) {
0257     return std::forward<_T1>(__t) | std::forward<_T2>(__u);
0258   }
0259   typedef void is_transparent;
0260 };
0261 #endif
0262 
0263 #if _LIBCPP_STD_VER >= 14
0264 template <class _Tp = void>
0265 #else
0266 template <class _Tp>
0267 #endif
0268 struct _LIBCPP_TEMPLATE_VIS bit_xor : __binary_function<_Tp, _Tp, _Tp> {
0269   typedef _Tp __result_type; // used by valarray
0270   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI _Tp operator()(const _Tp& __x, const _Tp& __y) const {
0271     return __x ^ __y;
0272   }
0273 };
0274 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(bit_xor);
0275 
0276 #if _LIBCPP_STD_VER >= 14
0277 template <>
0278 struct _LIBCPP_TEMPLATE_VIS bit_xor<void> {
0279   template <class _T1, class _T2>
0280   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
0281       noexcept(noexcept(std::forward<_T1>(__t) ^ std::forward<_T2>(__u))) //
0282       -> decltype(std::forward<_T1>(__t) ^ std::forward<_T2>(__u)) {
0283     return std::forward<_T1>(__t) ^ std::forward<_T2>(__u);
0284   }
0285   typedef void is_transparent;
0286 };
0287 #endif
0288 
0289 // Comparison operations
0290 
0291 #if _LIBCPP_STD_VER >= 14
0292 template <class _Tp = void>
0293 #else
0294 template <class _Tp>
0295 #endif
0296 struct _LIBCPP_TEMPLATE_VIS equal_to : __binary_function<_Tp, _Tp, bool> {
0297   typedef bool __result_type; // used by valarray
0298   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
0299     return __x == __y;
0300   }
0301 };
0302 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(equal_to);
0303 
0304 #if _LIBCPP_STD_VER >= 14
0305 template <>
0306 struct _LIBCPP_TEMPLATE_VIS equal_to<void> {
0307   template <class _T1, class _T2>
0308   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
0309       noexcept(noexcept(std::forward<_T1>(__t) == std::forward<_T2>(__u))) //
0310       -> decltype(std::forward<_T1>(__t) == std::forward<_T2>(__u)) {
0311     return std::forward<_T1>(__t) == std::forward<_T2>(__u);
0312   }
0313   typedef void is_transparent;
0314 };
0315 #endif
0316 
0317 // The non-transparent std::equal_to specialization is only equivalent to a raw equality
0318 // comparison when we don't perform an implicit conversion when calling it.
0319 template <class _Tp>
0320 inline const bool __desugars_to_v<__equal_tag, equal_to<_Tp>, _Tp, _Tp> = true;
0321 
0322 // In the transparent case, we do not enforce that
0323 template <class _Tp, class _Up>
0324 inline const bool __desugars_to_v<__equal_tag, equal_to<void>, _Tp, _Up> = true;
0325 
0326 #if _LIBCPP_STD_VER >= 14
0327 template <class _Tp = void>
0328 #else
0329 template <class _Tp>
0330 #endif
0331 struct _LIBCPP_TEMPLATE_VIS not_equal_to : __binary_function<_Tp, _Tp, bool> {
0332   typedef bool __result_type; // used by valarray
0333   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
0334     return __x != __y;
0335   }
0336 };
0337 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(not_equal_to);
0338 
0339 #if _LIBCPP_STD_VER >= 14
0340 template <>
0341 struct _LIBCPP_TEMPLATE_VIS not_equal_to<void> {
0342   template <class _T1, class _T2>
0343   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
0344       noexcept(noexcept(std::forward<_T1>(__t) != std::forward<_T2>(__u))) //
0345       -> decltype(std::forward<_T1>(__t) != std::forward<_T2>(__u)) {
0346     return std::forward<_T1>(__t) != std::forward<_T2>(__u);
0347   }
0348   typedef void is_transparent;
0349 };
0350 #endif
0351 
0352 #if _LIBCPP_STD_VER >= 14
0353 template <class _Tp = void>
0354 #else
0355 template <class _Tp>
0356 #endif
0357 struct _LIBCPP_TEMPLATE_VIS less : __binary_function<_Tp, _Tp, bool> {
0358   typedef bool __result_type; // used by valarray
0359   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
0360     return __x < __y;
0361   }
0362 };
0363 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(less);
0364 
0365 template <class _Tp>
0366 inline const bool __desugars_to_v<__less_tag, less<_Tp>, _Tp, _Tp> = true;
0367 
0368 template <class _Tp>
0369 inline const bool __desugars_to_v<__totally_ordered_less_tag, less<_Tp>, _Tp, _Tp> = is_integral<_Tp>::value;
0370 
0371 #if _LIBCPP_STD_VER >= 14
0372 template <>
0373 struct _LIBCPP_TEMPLATE_VIS less<void> {
0374   template <class _T1, class _T2>
0375   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
0376       noexcept(noexcept(std::forward<_T1>(__t) < std::forward<_T2>(__u))) //
0377       -> decltype(std::forward<_T1>(__t) < std::forward<_T2>(__u)) {
0378     return std::forward<_T1>(__t) < std::forward<_T2>(__u);
0379   }
0380   typedef void is_transparent;
0381 };
0382 
0383 template <class _Tp, class _Up>
0384 inline const bool __desugars_to_v<__less_tag, less<>, _Tp, _Up> = true;
0385 
0386 template <class _Tp>
0387 inline const bool __desugars_to_v<__totally_ordered_less_tag, less<>, _Tp, _Tp> = is_integral<_Tp>::value;
0388 #endif
0389 
0390 #if _LIBCPP_STD_VER >= 14
0391 template <class _Tp = void>
0392 #else
0393 template <class _Tp>
0394 #endif
0395 struct _LIBCPP_TEMPLATE_VIS less_equal : __binary_function<_Tp, _Tp, bool> {
0396   typedef bool __result_type; // used by valarray
0397   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
0398     return __x <= __y;
0399   }
0400 };
0401 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(less_equal);
0402 
0403 #if _LIBCPP_STD_VER >= 14
0404 template <>
0405 struct _LIBCPP_TEMPLATE_VIS less_equal<void> {
0406   template <class _T1, class _T2>
0407   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
0408       noexcept(noexcept(std::forward<_T1>(__t) <= std::forward<_T2>(__u))) //
0409       -> decltype(std::forward<_T1>(__t) <= std::forward<_T2>(__u)) {
0410     return std::forward<_T1>(__t) <= std::forward<_T2>(__u);
0411   }
0412   typedef void is_transparent;
0413 };
0414 #endif
0415 
0416 #if _LIBCPP_STD_VER >= 14
0417 template <class _Tp = void>
0418 #else
0419 template <class _Tp>
0420 #endif
0421 struct _LIBCPP_TEMPLATE_VIS greater_equal : __binary_function<_Tp, _Tp, bool> {
0422   typedef bool __result_type; // used by valarray
0423   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
0424     return __x >= __y;
0425   }
0426 };
0427 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(greater_equal);
0428 
0429 #if _LIBCPP_STD_VER >= 14
0430 template <>
0431 struct _LIBCPP_TEMPLATE_VIS greater_equal<void> {
0432   template <class _T1, class _T2>
0433   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
0434       noexcept(noexcept(std::forward<_T1>(__t) >=
0435                         std::forward<_T2>(__u))) -> decltype(std::forward<_T1>(__t) >= std::forward<_T2>(__u)) {
0436     return std::forward<_T1>(__t) >= std::forward<_T2>(__u);
0437   }
0438   typedef void is_transparent;
0439 };
0440 #endif
0441 
0442 #if _LIBCPP_STD_VER >= 14
0443 template <class _Tp = void>
0444 #else
0445 template <class _Tp>
0446 #endif
0447 struct _LIBCPP_TEMPLATE_VIS greater : __binary_function<_Tp, _Tp, bool> {
0448   typedef bool __result_type; // used by valarray
0449   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
0450     return __x > __y;
0451   }
0452 };
0453 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(greater);
0454 
0455 template <class _Tp>
0456 inline const bool __desugars_to_v<__greater_tag, greater<_Tp>, _Tp, _Tp> = true;
0457 
0458 #if _LIBCPP_STD_VER >= 14
0459 template <>
0460 struct _LIBCPP_TEMPLATE_VIS greater<void> {
0461   template <class _T1, class _T2>
0462   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
0463       noexcept(noexcept(std::forward<_T1>(__t) > std::forward<_T2>(__u))) //
0464       -> decltype(std::forward<_T1>(__t) > std::forward<_T2>(__u)) {
0465     return std::forward<_T1>(__t) > std::forward<_T2>(__u);
0466   }
0467   typedef void is_transparent;
0468 };
0469 
0470 template <class _Tp, class _Up>
0471 inline const bool __desugars_to_v<__greater_tag, greater<>, _Tp, _Up> = true;
0472 #endif
0473 
0474 // Logical operations
0475 
0476 #if _LIBCPP_STD_VER >= 14
0477 template <class _Tp = void>
0478 #else
0479 template <class _Tp>
0480 #endif
0481 struct _LIBCPP_TEMPLATE_VIS logical_and : __binary_function<_Tp, _Tp, bool> {
0482   typedef bool __result_type; // used by valarray
0483   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
0484     return __x && __y;
0485   }
0486 };
0487 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_and);
0488 
0489 #if _LIBCPP_STD_VER >= 14
0490 template <>
0491 struct _LIBCPP_TEMPLATE_VIS logical_and<void> {
0492   template <class _T1, class _T2>
0493   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
0494       noexcept(noexcept(std::forward<_T1>(__t) && std::forward<_T2>(__u))) //
0495       -> decltype(std::forward<_T1>(__t) && std::forward<_T2>(__u)) {
0496     return std::forward<_T1>(__t) && std::forward<_T2>(__u);
0497   }
0498   typedef void is_transparent;
0499 };
0500 #endif
0501 
0502 #if _LIBCPP_STD_VER >= 14
0503 template <class _Tp = void>
0504 #else
0505 template <class _Tp>
0506 #endif
0507 struct _LIBCPP_TEMPLATE_VIS logical_not : __unary_function<_Tp, bool> {
0508   typedef bool __result_type; // used by valarray
0509   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x) const { return !__x; }
0510 };
0511 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_not);
0512 
0513 #if _LIBCPP_STD_VER >= 14
0514 template <>
0515 struct _LIBCPP_TEMPLATE_VIS logical_not<void> {
0516   template <class _Tp>
0517   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_Tp&& __x) const
0518       noexcept(noexcept(!std::forward<_Tp>(__x))) //
0519       -> decltype(!std::forward<_Tp>(__x)) {
0520     return !std::forward<_Tp>(__x);
0521   }
0522   typedef void is_transparent;
0523 };
0524 #endif
0525 
0526 #if _LIBCPP_STD_VER >= 14
0527 template <class _Tp = void>
0528 #else
0529 template <class _Tp>
0530 #endif
0531 struct _LIBCPP_TEMPLATE_VIS logical_or : __binary_function<_Tp, _Tp, bool> {
0532   typedef bool __result_type; // used by valarray
0533   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI bool operator()(const _Tp& __x, const _Tp& __y) const {
0534     return __x || __y;
0535   }
0536 };
0537 _LIBCPP_CTAD_SUPPORTED_FOR_TYPE(logical_or);
0538 
0539 #if _LIBCPP_STD_VER >= 14
0540 template <>
0541 struct _LIBCPP_TEMPLATE_VIS logical_or<void> {
0542   template <class _T1, class _T2>
0543   _LIBCPP_CONSTEXPR_SINCE_CXX14 _LIBCPP_HIDE_FROM_ABI auto operator()(_T1&& __t, _T2&& __u) const
0544       noexcept(noexcept(std::forward<_T1>(__t) || std::forward<_T2>(__u))) //
0545       -> decltype(std::forward<_T1>(__t) || std::forward<_T2>(__u)) {
0546     return std::forward<_T1>(__t) || std::forward<_T2>(__u);
0547   }
0548   typedef void is_transparent;
0549 };
0550 #endif
0551 
0552 _LIBCPP_END_NAMESPACE_STD
0553 
0554 #endif // _LIBCPP___FUNCTIONAL_OPERATIONS_H