That still wont cut it in this scenario, as the OP says"
You can erase items from a list as your iterating it, you just need to stash the next iterator before you do stuff to the current one.
That would mean that it's possible that the iterator obtained before doStuffWith(it); pointed to the item which got removed, which means that iterator is now invalid.
It could also result in removing other objects from the list
In fact if the current item was not removed but the next item was, then you must only advance the iterator at the end of the iteration, as per normal iteration.
The problem is that in the case being described, there is no way to know whether the current item it being deleted or the next item is being deleted. So you don't know whether to get the advanced iterator at the beginning of or the end of each iteration.
Hence it is not solvable without at least some information about what is deleted coming back to the code in this loop. If you don't know the current item or the next item is always still there at the end of each iteration, then you can't do it.