c++ - How to iterate over a STL set and selectively remove elements? -


The following code does not work properly How should this be done correctly? (Std :: set & lt; color & gt; :: iterator i = myColourContainer.begin (); i! = MyColorContainer.end (); ++ i) {If for the

  (* I == Yellow) {DoSomeProccessing (* i); MyColorContainer.erase (i); You do not need a loop in the form of dealing with a set. / P> 
  std :: set & lt; Color & gt; :: iterator = myColorContainer.find (yellow); If (this! = It.myColorContainer.end ()) {DoSomeProcessing (* this); MyColorContainer.erase (this); }  

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -