boost绑定编译错误

发布于 2024-08-11 00:58:09 字数 695 浏览 3 评论 0原文

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 

有人可以告诉我我做错了什么吗?

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()
            );
}

I am getting errors like:

 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 

Can someone tell me what I am doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

温柔女人霸气范 2024-08-18 00:58:09

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

A::OutOfRange is a function of 4 arguments - implicit *this being the first argument, which is missing in your bind clause

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文