-
4 votesanswersviews
std :: bind和boost :: bind与多态性之间的区别
我有一个派生类,我绑定了一个虚函数,我没有在这个类中重写,所以我希望调用父类的一个 .它适用于boost(1.55),但如果我从C 11切换到std :: bind,它拒绝编译 错误C2100:非法间接1>功能(1152):参见函数模板实例化'_Rx std :: _ Pmf_wrap <_Pmf_t,_Rx,_Farg0,_V0_t,_V1_t,_V2_t,_V3_t,_V4_t,... -
2 votesanswersviews
boost :: bind打破严格别名规则?
使用Boost 1.43和GCC 4.4.3,代码如下 boost::bind(&SomeObject::memberFunc, this, _1)); 生成以下警告 boost / function / function_base.hpp:321:警告:解除引用类型惩罚指针将破坏严格别名规则 在没有设置-fno-strict-aliasing的情况下消除这些警告的正确方法是什么? -
2 votesanswersviews
boost :: bind与成员函数(作为boost :: asio异步写入处理程序)
我正在使用boost :: bind将处理函数传递给boost :: asio :: async_write . 当我使用自由函数时,它工作正常,但是当我尝试在类中移动函数时,bind会产生我无法解密的错误 . 什么有效: 我写了一些数据: boost::asio::async_write(*socket, boost::asio::buffer(... -
2 votesanswersviews
识别boost :: shared_ptr <boost :: thread>中的对象
我正在基于boost网站上的示例构建应用程序 . 以下是相关的定义: typedef boost::shared_ptr< connection > connection_ptr; std::set< connection_ptr> connections_; std::vector< boost::shared_ptr< boost::thread> &... -
1 votesanswersviews
尝试为boost :::: asio :: deadline_timer设置成员函数时出现Boost :: bind编译错误
我在尝试创建boost :: asio :: deadline_timer时遇到的编译错误有点问题 . 我在MSVC10上使用以下代码示例获得了以下错误 . 它是用Boost 1.48构建的 第一个错误看起来像是抱怨将成员函数设置为async_wait作为引用的处理程序 . 但是,当我更改参数时,它会给出类似的错误 . 我做错了 . 我的代码类似于this示例,我使用bind和deadline_t... -
0 votesanswersviews
如何将参数绑定到boost :: function?
来自boost :: bind docs(http://www.boost.org/doc/libs/1_53_0/libs/bind/bind.html#with_functions),"The arguments that bind takes are copied and held internally by the returned function object",但...