Erasing Iterators from STL Containers (STL Vector, etc.) in a Loop


for( vector<aType>::iterator it = aVec.begin(); 
      it != aVec.end(); 
      it = (*it).shouldDelete()?aVec.erase(it):it+1){
   // do stuff
}

, , , , , , , , , ,

  1. #1 by google plus app for android on September 19, 2014 - 11:29 pm

    Greate pieces. Keep posting such kind of information on your page.
    Im really impressed by it.
    Hi there, You’ve done a fantastic job. I will definitely digg it and for my part suggest
    to my friends. I am sure they’ll be benefited from this site.

  2. #2 by ครีมคูเวต on December 10, 2014 - 8:06 am

    Right away I am ready to do my breakfast, when having my breakfast coming again to read additional news.

(will not be published)