c++ - boost 绑定(bind)编译错误

标签 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 

谁能告诉我我做错了什么?

最佳答案

A::OutOfRange 是一个有 4 个参数的函数 - 隐式 *this 是第一个参数,你的 bind 子句中缺少它

关于c++ - boost 绑定(bind)编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1715674/

相关文章:

c++ - 这是 Visual Studio 2013 update 4 C++ 优化器错误还是我的代码有误?

python - 如何使用 boost/python 从 C++ 导入 .py 文件中的类?

c++ - 使用 boost::bind 传递比预期更多的参数安全吗?

c++ - 如何将代码与 virtualbox 集成?

c++ - 包含引用的 STL 映射无法编译

c++ - 如何使用 dyn.load 获取加载到 R 中的 DLL 中的函数列表

c++ - 通过 boost::bind 从 vector 中删除字符串

c++ - 是否可以为给定的静态库人为地诱导目标文件提取?

c++ - 如何在 boost asio 中设置阻塞套接字的超时时间?

c++ - 如何定义和使用 boost::function with "optional arguments"?