title: Why can't I remove a string from a std::set with std::remove_if?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/800955/remove-if-equivalent-for-stdmap">remove_if equivalent for std::map</a>  </p>
  </blockquote>
  
  
  
  <p>I have a set of strings:</p>
  
  <pre><code>set &lt;wstring&gt; strings;
  // ...
  </code></pre>
  
  <p>I wish to remove strings according to a predicate, e.g.:</p>
  
  <pre><code>std::remove_if ( strings.begin(), strings.end(), []( const wstring &amp;s ) -&gt; bool { return s == L"matching"; });
  </code></pre>
  
  <p>When I attempt this, I get the following compiler error:</p>
  
  <pre><code>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\algorithm(1840): error C2678: binary '=' : no operator found which takes a left-hand operand of type 'const std::basic_string&lt;_Elem,_Traits,_Ax&gt;' 
  </code></pre>
  
  <p>The error appears to suggest that <code>std::string</code> doesn't have a by-value copy constructor ( which would be illegal).  Is it somehow bad to use <code>std::remove_if</code> with <code>std::set</code> ?  Should I be doing something else instead such as several iterations of <code>set::find()</code> followed by <code>set::erase()</code> ?</p>