提升绑定编译错误

时间:2009-11-11 14:52:06

标签: c++ boost boost-bind erase-remove-idiom

class A
{
   bool OutofRange(string& a, string& b, string c);
   void Get(vector <string>& str, string& a, string& b);
}

void A::Get(vector <string>& str, string& a, string& b)
{
   str.erase(
            std::remove_if (str.begin(), str.end(), BOOST_BIND(&A::OutOfRange, a, b, _1)),
            str.end()
            );
}

我收到的错误如下:

 Error 7 error C2825: 'F': must be a class or namespace when followed by '::' File:bind.hpp
 Error 8 error C2039: 'result_type' : is not a member of '`global namespace'' t:\3rdparty\cpp\boost\boost-1.38.0\include\boost\bind.hpp 67 

有人能告诉我我做错了吗?

1 个答案:

答案 0 :(得分:14)

A :: OutOfRange是4个参数的函数 - 隐式*这是第一个参数,在你的绑定子句中缺少