Advertisement
spacechase0

Delete From List

Jun 8th, 2013
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.17 KB | None | 0 0
  1. std::list< int > list;
  2. for ( auto it = list.begin(); it != list.end(); ++it )
  3. {
  4.     if ( /* ... */ )
  5.     {
  6.         auto tmpIt = it; ++tmpIt;
  7.         list.erase( it );
  8.         it = tmpIt;
  9.     }
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement