Closed human-0 closed 4 years ago
Ah, this loop was adapted from a regular for loop, brain fart meant it wasn't correct.
However, this is not entirely correct. While you are right about the iterator not being incremented in the loop itself, passing the iterator to the erase function will infact increment the iterator.
Otherwise, an if statement that does the increment will suffice.
erase()
invalidates the iterator being erased, so that it can no longer be incremented. This results in an error in debug mode, and possibly other behaviours in release mode.