Hi,
Im trying to remove an element from a vector inside a loop using an iterator, which it seems I am doing incorrectly.
Looking around it seems this fails (it gives a segmentation fault) because i am using an invalidated iterator, but im not sure how to correct this?Code:for(vector<bomb>::iterator bm = bombs.begin(); bm!=bombs.end(); ++bm) { .... bombs.erase(bm); }
Thanks for any help.
Jack