codekingpro/portable-devtools
114k
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-exception7// SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES.8//9//===----------------------------------------------------------------------===//10 11#ifndef _LIBCUDACXX___FUNCTIONAL_OPERATIONS_H12#define _LIBCUDACXX___FUNCTIONAL_OPERATIONS_H13 14#ifndef __cuda_std__15#include <__config>16#endif // __cuda_std__17 18#include "../__functional/binary_function.h"19#include "../__functional/unary_function.h"20#include "../__utility/forward.h"21 22#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)23# pragma GCC system_header24#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)25# pragma clang system_header26#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)27# pragma system_header28#endif // no system header29 30_LIBCUDACXX_BEGIN_NAMESPACE_STD31 32// Arithmetic operations33 34#if _LIBCUDACXX_STD_VER > 1135template <class _Tp = void>36#else37template <class _Tp>38#endif39struct _LIBCUDACXX_TEMPLATE_VIS plus40 : __binary_function<_Tp, _Tp, _Tp>41{42 typedef _Tp __result_type; // used by valarray43 _LIBCUDACXX_DISABLE_EXEC_CHECK44 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY45 _Tp operator()(const _Tp& __x, const _Tp& __y) const46 {return __x + __y;}47};48_LIBCUDACXX_CTAD_SUPPORTED_FOR_TYPE(plus);49 50#if _LIBCUDACXX_STD_VER > 1151template <>52struct _LIBCUDACXX_TEMPLATE_VIS plus<void>53{54 _LIBCUDACXX_DISABLE_EXEC_CHECK55 template <class _T1, class _T2>56 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY57 auto operator()(_T1&& __t, _T2&& __u) const58 noexcept(noexcept(_CUDA_VSTD::forward<_T1>(__t) + _CUDA_VSTD::forward<_T2>(__u)))59 -> decltype( _CUDA_VSTD::forward<_T1>(__t) + _CUDA_VSTD::forward<_T2>(__u))60 { return _CUDA_VSTD::forward<_T1>(__t) + _CUDA_VSTD::forward<_T2>(__u); }61 typedef void is_transparent;62};63#endif64 65#if _LIBCUDACXX_STD_VER > 1166template <class _Tp = void>67#else68template <class _Tp>69#endif70struct _LIBCUDACXX_TEMPLATE_VIS minus71 : __binary_function<_Tp, _Tp, _Tp>72{73 typedef _Tp __result_type; // used by valarray74 _LIBCUDACXX_DISABLE_EXEC_CHECK75 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY76 _Tp operator()(const _Tp& __x, const _Tp& __y) const77 {return __x - __y;}78};79_LIBCUDACXX_CTAD_SUPPORTED_FOR_TYPE(minus);80 81#if _LIBCUDACXX_STD_VER > 1182template <>83struct _LIBCUDACXX_TEMPLATE_VIS minus<void>84{85 _LIBCUDACXX_DISABLE_EXEC_CHECK86 template <class _T1, class _T2>87 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY88 auto operator()(_T1&& __t, _T2&& __u) const89 noexcept(noexcept(_CUDA_VSTD::forward<_T1>(__t) - _CUDA_VSTD::forward<_T2>(__u)))90 -> decltype( _CUDA_VSTD::forward<_T1>(__t) - _CUDA_VSTD::forward<_T2>(__u))91 { return _CUDA_VSTD::forward<_T1>(__t) - _CUDA_VSTD::forward<_T2>(__u); }92 typedef void is_transparent;93};94#endif95 96#if _LIBCUDACXX_STD_VER > 1197template <class _Tp = void>98#else99template <class _Tp>100#endif101struct _LIBCUDACXX_TEMPLATE_VIS multiplies102 : __binary_function<_Tp, _Tp, _Tp>103{104 typedef _Tp __result_type; // used by valarray105 _LIBCUDACXX_DISABLE_EXEC_CHECK106 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY107 _Tp operator()(const _Tp& __x, const _Tp& __y) const108 {return __x * __y;}109};110_LIBCUDACXX_CTAD_SUPPORTED_FOR_TYPE(multiplies);111 112#if _LIBCUDACXX_STD_VER > 11113template <>114struct _LIBCUDACXX_TEMPLATE_VIS multiplies<void>115{116 _LIBCUDACXX_DISABLE_EXEC_CHECK117 template <class _T1, class _T2>118 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY119 auto operator()(_T1&& __t, _T2&& __u) const120 noexcept(noexcept(_CUDA_VSTD::forward<_T1>(__t) * _CUDA_VSTD::forward<_T2>(__u)))121 -> decltype( _CUDA_VSTD::forward<_T1>(__t) * _CUDA_VSTD::forward<_T2>(__u))122 { return _CUDA_VSTD::forward<_T1>(__t) * _CUDA_VSTD::forward<_T2>(__u); }123 typedef void is_transparent;124};125#endif126 127#if _LIBCUDACXX_STD_VER > 11128template <class _Tp = void>129#else130template <class _Tp>131#endif132struct _LIBCUDACXX_TEMPLATE_VIS divides133 : __binary_function<_Tp, _Tp, _Tp>134{135 typedef _Tp __result_type; // used by valarray136 _LIBCUDACXX_DISABLE_EXEC_CHECK137 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY138 _Tp operator()(const _Tp& __x, const _Tp& __y) const139 {return __x / __y;}140};141_LIBCUDACXX_CTAD_SUPPORTED_FOR_TYPE(divides);142 143#if _LIBCUDACXX_STD_VER > 11144template <>145struct _LIBCUDACXX_TEMPLATE_VIS divides<void>146{147 _LIBCUDACXX_DISABLE_EXEC_CHECK148 template <class _T1, class _T2>149 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY150 auto operator()(_T1&& __t, _T2&& __u) const151 noexcept(noexcept(_CUDA_VSTD::forward<_T1>(__t) / _CUDA_VSTD::forward<_T2>(__u)))152 -> decltype( _CUDA_VSTD::forward<_T1>(__t) / _CUDA_VSTD::forward<_T2>(__u))153 { return _CUDA_VSTD::forward<_T1>(__t) / _CUDA_VSTD::forward<_T2>(__u); }154 typedef void is_transparent;155};156#endif157 158#if _LIBCUDACXX_STD_VER > 11159template <class _Tp = void>160#else161template <class _Tp>162#endif163struct _LIBCUDACXX_TEMPLATE_VIS modulus164 : __binary_function<_Tp, _Tp, _Tp>165{166 typedef _Tp __result_type; // used by valarray167 _LIBCUDACXX_DISABLE_EXEC_CHECK168 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY169 _Tp operator()(const _Tp& __x, const _Tp& __y) const170 {return __x % __y;}171};172_LIBCUDACXX_CTAD_SUPPORTED_FOR_TYPE(modulus);173 174#if _LIBCUDACXX_STD_VER > 11175template <>176struct _LIBCUDACXX_TEMPLATE_VIS modulus<void>177{178 _LIBCUDACXX_DISABLE_EXEC_CHECK179 template <class _T1, class _T2>180 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY181 auto operator()(_T1&& __t, _T2&& __u) const182 noexcept(noexcept(_CUDA_VSTD::forward<_T1>(__t) % _CUDA_VSTD::forward<_T2>(__u)))183 -> decltype( _CUDA_VSTD::forward<_T1>(__t) % _CUDA_VSTD::forward<_T2>(__u))184 { return _CUDA_VSTD::forward<_T1>(__t) % _CUDA_VSTD::forward<_T2>(__u); }185 typedef void is_transparent;186};187#endif188 189#if _LIBCUDACXX_STD_VER > 11190template <class _Tp = void>191#else192template <class _Tp>193#endif194struct _LIBCUDACXX_TEMPLATE_VIS negate195 : __unary_function<_Tp, _Tp>196{197 typedef _Tp __result_type; // used by valarray198 _LIBCUDACXX_DISABLE_EXEC_CHECK199 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY200 _Tp operator()(const _Tp& __x) const201 {return -__x;}202};203_LIBCUDACXX_CTAD_SUPPORTED_FOR_TYPE(negate);204 205#if _LIBCUDACXX_STD_VER > 11206template <>207struct _LIBCUDACXX_TEMPLATE_VIS negate<void>208{209 _LIBCUDACXX_DISABLE_EXEC_CHECK210 template <class _Tp>211 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY212 auto operator()(_Tp&& __x) const213 noexcept(noexcept(- _CUDA_VSTD::forward<_Tp>(__x)))214 -> decltype( - _CUDA_VSTD::forward<_Tp>(__x))215 { return - _CUDA_VSTD::forward<_Tp>(__x); }216 typedef void is_transparent;217};218#endif219 220// Bitwise operations221 222#if _LIBCUDACXX_STD_VER > 11223template <class _Tp = void>224#else225template <class _Tp>226#endif227struct _LIBCUDACXX_TEMPLATE_VIS bit_and228 : __binary_function<_Tp, _Tp, _Tp>229{230 typedef _Tp __result_type; // used by valarray231 _LIBCUDACXX_DISABLE_EXEC_CHECK232 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY233 _Tp operator()(const _Tp& __x, const _Tp& __y) const234 {return __x & __y;}235};236_LIBCUDACXX_CTAD_SUPPORTED_FOR_TYPE(bit_and);237 238#if _LIBCUDACXX_STD_VER > 11239template <>240struct _LIBCUDACXX_TEMPLATE_VIS bit_and<void>241{242 _LIBCUDACXX_DISABLE_EXEC_CHECK243 template <class _T1, class _T2>244 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY245 auto operator()(_T1&& __t, _T2&& __u) const246 noexcept(noexcept(_CUDA_VSTD::forward<_T1>(__t) & _CUDA_VSTD::forward<_T2>(__u)))247 -> decltype( _CUDA_VSTD::forward<_T1>(__t) & _CUDA_VSTD::forward<_T2>(__u))248 { return _CUDA_VSTD::forward<_T1>(__t) & _CUDA_VSTD::forward<_T2>(__u); }249 typedef void is_transparent;250};251#endif252 253#if _LIBCUDACXX_STD_VER > 11254template <class _Tp = void>255struct _LIBCUDACXX_TEMPLATE_VIS bit_not256 : __unary_function<_Tp, _Tp>257{258 _LIBCUDACXX_DISABLE_EXEC_CHECK259 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY260 _Tp operator()(const _Tp& __x) const261 {return ~__x;}262};263_LIBCUDACXX_CTAD_SUPPORTED_FOR_TYPE(bit_not);264 265template <>266struct _LIBCUDACXX_TEMPLATE_VIS bit_not<void>267{268 _LIBCUDACXX_DISABLE_EXEC_CHECK269 template <class _Tp>270 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY271 auto operator()(_Tp&& __x) const272 noexcept(noexcept(~_CUDA_VSTD::forward<_Tp>(__x)))273 -> decltype( ~_CUDA_VSTD::forward<_Tp>(__x))274 { return ~_CUDA_VSTD::forward<_Tp>(__x); }275 typedef void is_transparent;276};277#endif278 279#if _LIBCUDACXX_STD_VER > 11280template <class _Tp = void>281#else282template <class _Tp>283#endif284struct _LIBCUDACXX_TEMPLATE_VIS bit_or285 : __binary_function<_Tp, _Tp, _Tp>286{287 typedef _Tp __result_type; // used by valarray288 _LIBCUDACXX_DISABLE_EXEC_CHECK289 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY290 _Tp operator()(const _Tp& __x, const _Tp& __y) const291 {return __x | __y;}292};293_LIBCUDACXX_CTAD_SUPPORTED_FOR_TYPE(bit_or);294 295#if _LIBCUDACXX_STD_VER > 11296template <>297struct _LIBCUDACXX_TEMPLATE_VIS bit_or<void>298{299 _LIBCUDACXX_DISABLE_EXEC_CHECK300 template <class _T1, class _T2>301 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY302 auto operator()(_T1&& __t, _T2&& __u) const303 noexcept(noexcept(_CUDA_VSTD::forward<_T1>(__t) | _CUDA_VSTD::forward<_T2>(__u)))304 -> decltype( _CUDA_VSTD::forward<_T1>(__t) | _CUDA_VSTD::forward<_T2>(__u))305 { return _CUDA_VSTD::forward<_T1>(__t) | _CUDA_VSTD::forward<_T2>(__u); }306 typedef void is_transparent;307};308#endif309 310#if _LIBCUDACXX_STD_VER > 11311template <class _Tp = void>312#else313template <class _Tp>314#endif315struct _LIBCUDACXX_TEMPLATE_VIS bit_xor316 : __binary_function<_Tp, _Tp, _Tp>317{318 typedef _Tp __result_type; // used by valarray319 _LIBCUDACXX_DISABLE_EXEC_CHECK320 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY321 _Tp operator()(const _Tp& __x, const _Tp& __y) const322 {return __x ^ __y;}323};324_LIBCUDACXX_CTAD_SUPPORTED_FOR_TYPE(bit_xor);325 326#if _LIBCUDACXX_STD_VER > 11327template <>328struct _LIBCUDACXX_TEMPLATE_VIS bit_xor<void>329{330 _LIBCUDACXX_DISABLE_EXEC_CHECK331 template <class _T1, class _T2>332 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY333 auto operator()(_T1&& __t, _T2&& __u) const334 noexcept(noexcept(_CUDA_VSTD::forward<_T1>(__t) ^ _CUDA_VSTD::forward<_T2>(__u)))335 -> decltype( _CUDA_VSTD::forward<_T1>(__t) ^ _CUDA_VSTD::forward<_T2>(__u))336 { return _CUDA_VSTD::forward<_T1>(__t) ^ _CUDA_VSTD::forward<_T2>(__u); }337 typedef void is_transparent;338};339#endif340 341// Comparison operations342 343#if _LIBCUDACXX_STD_VER > 11344template <class _Tp = void>345#else346template <class _Tp>347#endif348struct _LIBCUDACXX_TEMPLATE_VIS equal_to349 : __binary_function<_Tp, _Tp, bool>350{351 typedef bool __result_type; // used by valarray352 _LIBCUDACXX_DISABLE_EXEC_CHECK353 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY354 bool operator()(const _Tp& __x, const _Tp& __y) const355 {return __x == __y;}356};357_LIBCUDACXX_CTAD_SUPPORTED_FOR_TYPE(equal_to);358 359#if _LIBCUDACXX_STD_VER > 11360template <>361struct _LIBCUDACXX_TEMPLATE_VIS equal_to<void>362{363 _LIBCUDACXX_DISABLE_EXEC_CHECK364 template <class _T1, class _T2>365 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY366 auto operator()(_T1&& __t, _T2&& __u) const367 noexcept(noexcept(_CUDA_VSTD::forward<_T1>(__t) == _CUDA_VSTD::forward<_T2>(__u)))368 -> decltype( _CUDA_VSTD::forward<_T1>(__t) == _CUDA_VSTD::forward<_T2>(__u))369 { return _CUDA_VSTD::forward<_T1>(__t) == _CUDA_VSTD::forward<_T2>(__u); }370 typedef void is_transparent;371};372#endif373 374#if _LIBCUDACXX_STD_VER > 11375template <class _Tp = void>376#else377template <class _Tp>378#endif379struct _LIBCUDACXX_TEMPLATE_VIS not_equal_to380 : __binary_function<_Tp, _Tp, bool>381{382 typedef bool __result_type; // used by valarray383 _LIBCUDACXX_DISABLE_EXEC_CHECK384 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY385 bool operator()(const _Tp& __x, const _Tp& __y) const386 {return __x != __y;}387};388_LIBCUDACXX_CTAD_SUPPORTED_FOR_TYPE(not_equal_to);389 390#if _LIBCUDACXX_STD_VER > 11391template <>392struct _LIBCUDACXX_TEMPLATE_VIS not_equal_to<void>393{394 _LIBCUDACXX_DISABLE_EXEC_CHECK395 template <class _T1, class _T2>396 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY397 auto operator()(_T1&& __t, _T2&& __u) const398 noexcept(noexcept(_CUDA_VSTD::forward<_T1>(__t) != _CUDA_VSTD::forward<_T2>(__u)))399 -> decltype( _CUDA_VSTD::forward<_T1>(__t) != _CUDA_VSTD::forward<_T2>(__u))400 { return _CUDA_VSTD::forward<_T1>(__t) != _CUDA_VSTD::forward<_T2>(__u); }401 typedef void is_transparent;402};403#endif404 405#if _LIBCUDACXX_STD_VER > 11406template <class _Tp = void>407#else408template <class _Tp>409#endif410struct _LIBCUDACXX_TEMPLATE_VIS less411 : __binary_function<_Tp, _Tp, bool>412{413 typedef bool __result_type; // used by valarray414 _LIBCUDACXX_DISABLE_EXEC_CHECK415 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY416 bool operator()(const _Tp& __x, const _Tp& __y) const417 {return __x < __y;}418};419_LIBCUDACXX_CTAD_SUPPORTED_FOR_TYPE(less);420 421#if _LIBCUDACXX_STD_VER > 11422template <>423struct _LIBCUDACXX_TEMPLATE_VIS less<void>424{425 _LIBCUDACXX_DISABLE_EXEC_CHECK426 template <class _T1, class _T2>427 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY428 auto operator()(_T1&& __t, _T2&& __u) const429 noexcept(noexcept(_CUDA_VSTD::forward<_T1>(__t) < _CUDA_VSTD::forward<_T2>(__u)))430 -> decltype( _CUDA_VSTD::forward<_T1>(__t) < _CUDA_VSTD::forward<_T2>(__u))431 { return _CUDA_VSTD::forward<_T1>(__t) < _CUDA_VSTD::forward<_T2>(__u); }432 typedef void is_transparent;433};434#endif435 436#if _LIBCUDACXX_STD_VER > 11437template <class _Tp = void>438#else439template <class _Tp>440#endif441struct _LIBCUDACXX_TEMPLATE_VIS less_equal442 : __binary_function<_Tp, _Tp, bool>443{444 typedef bool __result_type; // used by valarray445 _LIBCUDACXX_DISABLE_EXEC_CHECK446 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY447 bool operator()(const _Tp& __x, const _Tp& __y) const448 {return __x <= __y;}449};450_LIBCUDACXX_CTAD_SUPPORTED_FOR_TYPE(less_equal);451 452#if _LIBCUDACXX_STD_VER > 11453template <>454struct _LIBCUDACXX_TEMPLATE_VIS less_equal<void>455{456 _LIBCUDACXX_DISABLE_EXEC_CHECK457 template <class _T1, class _T2>458 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY459 auto operator()(_T1&& __t, _T2&& __u) const460 noexcept(noexcept(_CUDA_VSTD::forward<_T1>(__t) <= _CUDA_VSTD::forward<_T2>(__u)))461 -> decltype( _CUDA_VSTD::forward<_T1>(__t) <= _CUDA_VSTD::forward<_T2>(__u))462 { return _CUDA_VSTD::forward<_T1>(__t) <= _CUDA_VSTD::forward<_T2>(__u); }463 typedef void is_transparent;464};465#endif466 467#if _LIBCUDACXX_STD_VER > 11468template <class _Tp = void>469#else470template <class _Tp>471#endif472struct _LIBCUDACXX_TEMPLATE_VIS greater_equal473 : __binary_function<_Tp, _Tp, bool>474{475 typedef bool __result_type; // used by valarray476 _LIBCUDACXX_DISABLE_EXEC_CHECK477 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY478 bool operator()(const _Tp& __x, const _Tp& __y) const479 {return __x >= __y;}480};481_LIBCUDACXX_CTAD_SUPPORTED_FOR_TYPE(greater_equal);482 483#if _LIBCUDACXX_STD_VER > 11484template <>485struct _LIBCUDACXX_TEMPLATE_VIS greater_equal<void>486{487 _LIBCUDACXX_DISABLE_EXEC_CHECK488 template <class _T1, class _T2>489 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY490 auto operator()(_T1&& __t, _T2&& __u) const491 noexcept(noexcept(_CUDA_VSTD::forward<_T1>(__t) >= _CUDA_VSTD::forward<_T2>(__u)))492 -> decltype( _CUDA_VSTD::forward<_T1>(__t) >= _CUDA_VSTD::forward<_T2>(__u))493 { return _CUDA_VSTD::forward<_T1>(__t) >= _CUDA_VSTD::forward<_T2>(__u); }494 typedef void is_transparent;495};496#endif497 498#if _LIBCUDACXX_STD_VER > 11499template <class _Tp = void>500#else501template <class _Tp>502#endif503struct _LIBCUDACXX_TEMPLATE_VIS greater504 : __binary_function<_Tp, _Tp, bool>505{506 typedef bool __result_type; // used by valarray507 _LIBCUDACXX_DISABLE_EXEC_CHECK508 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY509 bool operator()(const _Tp& __x, const _Tp& __y) const510 {return __x > __y;}511};512_LIBCUDACXX_CTAD_SUPPORTED_FOR_TYPE(greater);513 514#if _LIBCUDACXX_STD_VER > 11515template <>516struct _LIBCUDACXX_TEMPLATE_VIS greater<void>517{518 _LIBCUDACXX_DISABLE_EXEC_CHECK519 template <class _T1, class _T2>520 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY521 auto operator()(_T1&& __t, _T2&& __u) const522 noexcept(noexcept(_CUDA_VSTD::forward<_T1>(__t) > _CUDA_VSTD::forward<_T2>(__u)))523 -> decltype( _CUDA_VSTD::forward<_T1>(__t) > _CUDA_VSTD::forward<_T2>(__u))524 { return _CUDA_VSTD::forward<_T1>(__t) > _CUDA_VSTD::forward<_T2>(__u); }525 typedef void is_transparent;526};527#endif528 529// Logical operations530 531#if _LIBCUDACXX_STD_VER > 11532template <class _Tp = void>533#else534template <class _Tp>535#endif536struct _LIBCUDACXX_TEMPLATE_VIS logical_and537 : __binary_function<_Tp, _Tp, bool>538{539 typedef bool __result_type; // used by valarray540 _LIBCUDACXX_DISABLE_EXEC_CHECK541 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY542 bool operator()(const _Tp& __x, const _Tp& __y) const543 {return __x && __y;}544};545_LIBCUDACXX_CTAD_SUPPORTED_FOR_TYPE(logical_and);546 547#if _LIBCUDACXX_STD_VER > 11548template <>549struct _LIBCUDACXX_TEMPLATE_VIS logical_and<void>550{551 _LIBCUDACXX_DISABLE_EXEC_CHECK552 template <class _T1, class _T2>553 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY554 auto operator()(_T1&& __t, _T2&& __u) const555 noexcept(noexcept(_CUDA_VSTD::forward<_T1>(__t) && _CUDA_VSTD::forward<_T2>(__u)))556 -> decltype( _CUDA_VSTD::forward<_T1>(__t) && _CUDA_VSTD::forward<_T2>(__u))557 { return _CUDA_VSTD::forward<_T1>(__t) && _CUDA_VSTD::forward<_T2>(__u); }558 typedef void is_transparent;559};560#endif561 562#if _LIBCUDACXX_STD_VER > 11563template <class _Tp = void>564#else565template <class _Tp>566#endif567struct _LIBCUDACXX_TEMPLATE_VIS logical_not568 : __unary_function<_Tp, bool>569{570 typedef bool __result_type; // used by valarray571 _LIBCUDACXX_DISABLE_EXEC_CHECK572 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY573 bool operator()(const _Tp& __x) const574 {return !__x;}575};576_LIBCUDACXX_CTAD_SUPPORTED_FOR_TYPE(logical_not);577 578#if _LIBCUDACXX_STD_VER > 11579template <>580struct _LIBCUDACXX_TEMPLATE_VIS logical_not<void>581{582 _LIBCUDACXX_DISABLE_EXEC_CHECK583 template <class _Tp>584 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY585 auto operator()(_Tp&& __x) const586 noexcept(noexcept(!_CUDA_VSTD::forward<_Tp>(__x)))587 -> decltype( !_CUDA_VSTD::forward<_Tp>(__x))588 { return !_CUDA_VSTD::forward<_Tp>(__x); }589 typedef void is_transparent;590};591#endif592 593#if _LIBCUDACXX_STD_VER > 11594template <class _Tp = void>595#else596template <class _Tp>597#endif598struct _LIBCUDACXX_TEMPLATE_VIS logical_or599 : __binary_function<_Tp, _Tp, bool>600{601 typedef bool __result_type; // used by valarray602 _LIBCUDACXX_DISABLE_EXEC_CHECK603 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY604 bool operator()(const _Tp& __x, const _Tp& __y) const605 {return __x || __y;}606};607_LIBCUDACXX_CTAD_SUPPORTED_FOR_TYPE(logical_or);608 609#if _LIBCUDACXX_STD_VER > 11610template <>611struct _LIBCUDACXX_TEMPLATE_VIS logical_or<void>612{613 _LIBCUDACXX_DISABLE_EXEC_CHECK614 template <class _T1, class _T2>615 _LIBCUDACXX_CONSTEXPR_AFTER_CXX11 _LIBCUDACXX_INLINE_VISIBILITY616 auto operator()(_T1&& __t, _T2&& __u) const617 noexcept(noexcept(_CUDA_VSTD::forward<_T1>(__t) || _CUDA_VSTD::forward<_T2>(__u)))618 -> decltype( _CUDA_VSTD::forward<_T1>(__t) || _CUDA_VSTD::forward<_T2>(__u))619 { return _CUDA_VSTD::forward<_T1>(__t) || _CUDA_VSTD::forward<_T2>(__u); }620 typedef void is_transparent;621};622#endif623 624_LIBCUDACXX_END_NAMESPACE_STD625 626#endif // _LIBCUDACXX___FUNCTIONAL_OPERATIONS_H627 