title: How to iterate over a STL set and selectively remove elements?
body: <p>The following code does not work correctly. How should it be done correctly?</p>
  
  <pre><code>for (std::set&lt;Color&gt;::iterator i = myColorContainer.begin();
              i!=myColorContainer.end();
              ++i)
  {
      if ( *i  == Yellow)
      {
          DoSomeProccessing( *i );
          myColorContainer.erase(i);
      }
  }
  </code></pre>