Path: blob/main/contrib/llvm-project/libcxx/include/__functional/binder1st.h
35260 views
// -*- C++ -*-1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//89#ifndef _LIBCPP___FUNCTIONAL_BINDER1ST_H10#define _LIBCPP___FUNCTIONAL_BINDER1ST_H1112#include <__config>13#include <__functional/unary_function.h>1415#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)16# pragma GCC system_header17#endif1819_LIBCPP_BEGIN_NAMESPACE_STD2021#if _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)2223template <class _Operation>24class _LIBCPP_TEMPLATE_VIS _LIBCPP_DEPRECATED_IN_CXX11 binder1st25: public __unary_function<typename _Operation::second_argument_type, typename _Operation::result_type> {26protected:27_Operation op;28typename _Operation::first_argument_type value;2930public:31_LIBCPP_HIDE_FROM_ABI binder1st(const _Operation& __x, const typename _Operation::first_argument_type __y)32: op(__x), value(__y) {}33_LIBCPP_HIDE_FROM_ABI typename _Operation::result_type34operator()(typename _Operation::second_argument_type& __x) const {35return op(value, __x);36}37_LIBCPP_HIDE_FROM_ABI typename _Operation::result_type38operator()(const typename _Operation::second_argument_type& __x) const {39return op(value, __x);40}41};4243template <class _Operation, class _Tp>44_LIBCPP_DEPRECATED_IN_CXX11 inline _LIBCPP_HIDE_FROM_ABI binder1st<_Operation>45bind1st(const _Operation& __op, const _Tp& __x) {46return binder1st<_Operation>(__op, __x);47}4849#endif // _LIBCPP_STD_VER <= 14 || defined(_LIBCPP_ENABLE_CXX17_REMOVED_BINDERS)5051_LIBCPP_END_NAMESPACE_STD5253#endif // _LIBCPP___FUNCTIONAL_BINDER1ST_H545556