我只想知道如何在 lambda 表达式捕获括号内编写对。因为以下代码无法编译,所以我遗漏了一些东西......
std::vector<std::pair<std::string, std::string>> container1_;
for( auto iter : container1_ )
{
auto result = std::find_if( container2_.cbegin(), container2_.cend(),
[iter.first]( const std::string& str )->bool { return str == iter.first; } );
}
In member function ‘bool MsgChecker::CheckKeys()’:
error: expected ‘,’ before ‘.’ token
error: expected identifier before ‘.’ token