当前位置: 首页> 游戏> 评测 > app详情页设计_余干网站建设制作_百度网盘搜索免费资源_seo实训报告

app详情页设计_余干网站建设制作_百度网盘搜索免费资源_seo实训报告

时间:2025/7/9 22:58:17来源:https://blog.csdn.net/wuli2496/article/details/144493799 浏览次数:0次
app详情页设计_余干网站建设制作_百度网盘搜索免费资源_seo实训报告

简介

用于构造函数对象,其定义在文件bind.hpp

bind

其底层使用通用的模板类bind_t

template<class R, class F, class L> class bind_t
{
public:typedef bind_t this_type;bind_t(F f, L const & l): f_(f), l_(l) {}#define BOOST_BIND_RETURN return
#include <boost/bind/bind_template.hpp>
#undef BOOST_BIND_RETURN};

bind_t类中包含两个成员

private:F f_;//函数L l_;//参数列表构造的对象

不带参数的绑定

template<class R, class F>_bi::bind_t<R, F, _bi::list0>BOOST_BIND(F f)
{typedef _bi::list0 list_type;return _bi::bind_t<R, F, list_type> (f, list_type());
}

带1个参数的绑定

template<class R, class F, class A1>_bi::bind_t<R, F, typename _bi::list_av_1<A1>::type>BOOST_BIND(F f, A1 a1)
{typedef typename _bi::list_av_1<A1>::type list_type;return _bi::bind_t<R, F, list_type> (f, list_type(a1));
}template<class A1> struct list_av_1
{typedef typename add_value<A1>::type B1;typedef list1<B1> type;
};template< class A1 > class list1: private storage1< A1 > 
{public:explicit list1( A1 a1 ): base_type( a1 ) {}
};

bind_t中的list类型为list1<B1>,add_value<A1>::type类型为_bi::value< T >,其定义为

template<class T> class value
{
public:value(T const & t): t_(t) {}T & get() { return t_; }T const & get() const { return t_; }bool operator==(value const & rhs) const{return t_ == rhs.t_;}private:T t_;
};

从上面可以看出boost::bind传递参数实现是参数的拷贝

关键字:app详情页设计_余干网站建设制作_百度网盘搜索免费资源_seo实训报告

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: