Boost:bind and Boost::function
Boost:bind and Boost::function
我试图将我的成员函数用作boost函数,但它不起作用。
我猜以下错误消息:
warning C4180: qualifier applied to function type has no meaning; ignored
...boostboost_1_55_0boostbindbind_template.hpp(344) : see reference to class template instantiation 'boost::_mfi::dm<double (const std::vector<double,std::allocator<_Ty>> &),MyClass>' being compiled ...
然后我有一条弹出消息,说我必须点击"确定"这个消息:
C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V120Microsoft.CppCommon.targets(341,5): error MSB6006: "CL.exe" exited with code 1.
这是我的代码:
void MyClass::runProcess(){
boost::function<double(const std::vector<double> &)> f =
boost::bind(&MyClass::MyMemberFunction, this);
}
double MyClass::MyMemberFunction(const std::vector<double> & inX){
return 1.0;
}
您必须向bind()
调用添加占位符:
#include <boost/bind/placeholders.hpp>
boost::function<double(const std::vector<double> &)> f =
boost::bind(&MyClass::MyMemberFunction, this, _1);
// ^^^
相关文章:
- 如何将类成员函数与param绑定为boost::function的右值
- 自 1.55 以来,boost::bind / boost::function 中的奇怪行为变化
- 将 boost::function 与指向派生类的共享指针的参数一起使用
- 将 boost::function 和 boost::bind 替换为模板
- 如何从“boost::function”中获取 C 指针(如 'var (*)(vo
- 如何使用 boost::bind 将静态成员函数绑定到 boost::function
- 以 C++11 方式重写 boost 风味代码(Boost.Bind、Boost.Function)
- Boost:bind and Boost::function
- 将模板函数分配给 boost::function
- boost::function 和 std::tr1::function 之间是否有重要的区别需要了解
- 将 boost::function 与实例方法一起使用
- 将 Python 函数作为 Boost.Function 参数发送
- 将 C++11 std::function 传递给采用 boost::function 的遗留函数是否安全?
- 将 boost::function 转换为 std::function
- 使用 boost::bind 和 boost::function 将成员函数分配给回调
- 将赋值运算符绑定到 boost::function 对象
- 如何在"boost::function"中访问类实例(对象)指针?
- llvm g++ and boost function
- Using boost::function and boost::bind
- 为什么使用boost::function调用函数对象时不需要类实例