首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

std::binder1st

template< class Fn > class binder1st : public std::unary_function<typename Fn::second_argument_type, typename Fn::result_type> { protected: Fn op; typename Fn::first_argument_type value; public: binder1st(const Fn& fn, const typename Fn::first_argument_type& value); typename Fn::result_type operator()(const typename Fn::second_argument_type& x) const; typename Fn::result_type operator()(typename Fn::second_argument_type& x) const; };

(1)

(until C++17)(deprecated since C++11)

template< class Fn > class binder2nd : public unary_function<typename Fn::first_argument_type, typename Fn::result_type> { protected: Fn op; typename Fn::second_argument_type value; public: binder2nd(const Fn& fn, const typename Fn::second_argument_type& value); typename Fn::result_type operator()(const typename Fn::first_argument_type& x) const; typename Fn::result_type operator()(typename Fn::first_argument_type& x) const; };

(2)

(until C++17)(deprecated since C++11)

将参数绑定到二进制函数的函数对象。

参数的值在构造时传递给对象,并存储在对象中。但是,每当函数对象被调用时,operator(),存储的值作为参数之一传递,另一个参数作为operator()得到的函数对象是一元函数。

1%29将第一个参数绑定到值。value在物体的构造中给出的。

2%29将第二个参数绑定到值。value在物体的构造中给出的。

另见

bind1stbind2nd (until C++17)(until C++17)

binds one argument to a binary function (function template)

代码语言:txt
复制
 © cppreference.com

在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。

扫码关注腾讯云开发者

领取腾讯云代金券