Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/141.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 我不明白为什么这个不能编译_C++ - Fatal编程技术网

C++ 我不明白为什么这个不能编译

C++ 我不明白为什么这个不能编译,c++,C++,以下是错误: // m_values is of type std::vector<std::pair<std::string,INIValue> > std::find_if(this->m_values.begin(),this->m_values.end, [name](std::pair<std::string,INIValue> v)->bool { return v.first == name;}); 我遗漏了什么?您忘记了第

以下是错误:

// m_values is of type std::vector<std::pair<std::string,INIValue> >

std::find_if(this->m_values.begin(),this->m_values.end, [name](std::pair<std::string,INIValue> v)->bool { return v.first == name;});

我遗漏了什么?

您忘记了第二个参数的大括号

error: no matching function for call to ‘find_if(std::vector<std::pair<std::basic_string<char>, INIValue> >::iterator, <unresolved overloaded function type>, INISection::value(const string&)::__lambda0)’
此外,您可能需要稍微调整lambda。您搜索一个值,无需复制每个向量

this->m_values.end()

这个->m_values.endfacepalm我不敢相信我错过了,谢谢。我一直想弄明白为什么类型不匹配。也没必要复制名称?好吧,billz,我只是想把该死的东西编译一下。
[&name](const std::pair<std::string, INIValue> &v)->bool { return v.first == name;}