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_BINDER1ST_H12#define _LIBCUDACXX___FUNCTIONAL_BINDER1ST_H13 14#ifndef __cuda_std__15#include <__config>16#endif // __cuda_std__17 18#include "../__functional/unary_function.h"19 20#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)21# pragma GCC system_header22#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_CLANG)23# pragma clang system_header24#elif defined(_CCCL_IMPLICIT_SYSTEM_HEADER_MSVC)25# pragma system_header26#endif // no system header27 28_LIBCUDACXX_BEGIN_NAMESPACE_STD29 30#if _LIBCUDACXX_STD_VER <= 14 || defined(_LIBCUDACXX_ENABLE_CXX17_REMOVED_BINDERS)31 32_CCCL_DIAG_SUPPRESS_DEPRECATED_PUSH33 34template <class __Operation>35class _LIBCUDACXX_TEMPLATE_VIS _LIBCUDACXX_DEPRECATED_IN_CXX11 binder1st36 : public __unary_function<typename __Operation::second_argument_type, typename __Operation::result_type>37{38protected:39 __Operation op;40 typename __Operation::first_argument_type value;41public:42 _LIBCUDACXX_INLINE_VISIBILITY binder1st(const __Operation& __x,43 const typename __Operation::first_argument_type __y)44 : op(__x), value(__y) {}45 _LIBCUDACXX_DISABLE_EXEC_CHECK46 _LIBCUDACXX_INLINE_VISIBILITY typename __Operation::result_type operator()47 (typename __Operation::second_argument_type& __x) const48 {return op(value, __x);}49 _LIBCUDACXX_DISABLE_EXEC_CHECK50 _LIBCUDACXX_INLINE_VISIBILITY typename __Operation::result_type operator()51 (const typename __Operation::second_argument_type& __x) const52 {return op(value, __x);}53};54 55template <class __Operation, class _Tp>56_LIBCUDACXX_DEPRECATED_IN_CXX11 inline _LIBCUDACXX_INLINE_VISIBILITY57binder1st<__Operation>58bind1st(const __Operation& __op, const _Tp& __x)59 {return binder1st<__Operation>(__op, __x);}60 61_CCCL_DIAG_SUPPRESS_DEPRECATED_POP62 63#endif // _LIBCUDACXX_STD_VER <= 14 || defined(_LIBCUDACXX_ENABLE_CXX17_REMOVED_BINDERS)64 65_LIBCUDACXX_END_NAMESPACE_STD66 67#endif // _LIBCUDACXX___FUNCTIONAL_BINDER1ST_H68 