我试图使用我的成员函数作为一个促进功能,但它不起作用。
我猜以下错误消息:
warning C4180: qualifier applied to function type has no meaning; ignored
...\boost\boost_1_55_0\boost\bind\bind_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)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.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;
}发布于 2015-03-29 23:21:14
您必须向bind()调用添加一个占位符:
#include <boost/bind/placeholders.hpp>
boost::function<double(const std::vector<double> &)> f =
boost::bind(&MyClass::MyMemberFunction, this, _1);
// ^^^https://stackoverflow.com/questions/29335985
复制相似问题