<div dir="ltr"><div><span style="color:rgb(0,0,0);font-family:Arial,'Liberation Sans','DejaVu Sans',sans-serif;font-size:14px;line-height:18px">I am trying to write an efficient c++ function to remove some words from a big vector of strings.</span><br>
</div><div>Here my code using stl :</div><div><br></div><div><font color="#0000ff">vector<std::string> stripWords(vector<std::string>& input, </font></div><div><font color="#0000ff">                  std::set<std::string>& toRemove){ </font></div>
<div><font color="#0000ff">input.erase(</font></div><div><font color="#0000ff">     remove_if(input.begin(), input.end(), </font></div><div><font color="#0000ff">                 [&toRemove](const std::string& x) -> bool {</font></div>
<div><font color="#0000ff">                     return toRemove.find(x) != toRemove.end();</font></div><div><font color="#0000ff">                 }),input.end());</font></div><div><font color="#0000ff">}</font></div><div>
<font color="#0000ff"><br></font></div><div><div>But I get this warning about using lambda expression and this template error.</div></div><div><br></div><div><div><br></div><div><font color="#00ffff"> warning</font>: lambda expressions only available with -std=c++0x or -std=gnu++0x [enabled by default]</div>
<div><span style="color:rgb(255,0,0)"> error: no matching function for call to 'remove_if(std::vector<std::basic_string<char> >::iterator, std::vector<std::basic_string<char> >::iterator, stripWords(std::vector<std::basic_string<char> >&, std::set<std::basic_string<char> >&)::<lambda(const string&)>)'</span><br>
</div></div><div><span style="color:rgb(255,0,0)"><br></span></div><div><font color="#ff0000">agstudy</font></div><div><br></div><div><br></div></div>