Path: blob/main/contrib/llvm-project/libcxx/include/__cxx03/__functional/binder1st.h
213799 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___CXX03___FUNCTIONAL_BINDER1ST_H10#define _LIBCPP___CXX03___FUNCTIONAL_BINDER1ST_H1112#include <__cxx03/__config>13#include <__cxx03/__functional/unary_function.h>1415#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)16# pragma GCC system_header17#endif1819_LIBCPP_BEGIN_NAMESPACE_STD2021template <class _Operation>22class _LIBCPP_TEMPLATE_VIS binder1st23: public __unary_function<typename _Operation::second_argument_type, typename _Operation::result_type> {24protected:25_Operation op;26typename _Operation::first_argument_type value;2728public:29_LIBCPP_HIDE_FROM_ABI binder1st(const _Operation& __x, const typename _Operation::first_argument_type __y)30: op(__x), value(__y) {}31_LIBCPP_HIDE_FROM_ABI typename _Operation::result_type32operator()(typename _Operation::second_argument_type& __x) const {33return op(value, __x);34}35_LIBCPP_HIDE_FROM_ABI typename _Operation::result_type36operator()(const typename _Operation::second_argument_type& __x) const {37return op(value, __x);38}39};4041template <class _Operation, class _Tp>42inline _LIBCPP_HIDE_FROM_ABI binder1st<_Operation> bind1st(const _Operation& __op, const _Tp& __x) {43return binder1st<_Operation>(__op, __x);44}4546_LIBCPP_END_NAMESPACE_STD4748#endif // _LIBCPP___CXX03___FUNCTIONAL_BINDER1ST_H495051