您的位置:首页 > 产品设计 > UI/UE

g++中使用std map根据value查找find_if

2017-11-15 13:45 453 查看
error: no matching function for call to 'ptr_fun(<unresolved overloaded function type>)'

#include <algorithm>

#include <functional>

这两个是必须的

bool equal(std::pair<char*,devNode*> data,char* ip0)

{

 if(strcmp(data.second->ip,ip0) == 0)

 {

  return true;

 }else

 {

  return false;

 }

}

 map<char*,devNode*>::iterator iter_find;

iter_find = std::find_if(m_devListPreIns.begin(),m_devListPreIns.end(),std::bind2nd(std::ptr_fun(::equal),szip));

关键时候到了,哈哈,上面定义的equal函数前面的两个::是必须的,否则就会报告

 map<char*,devNode*>::iterator iter_find;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  stl find_if map g++