title: How to delete an element from a vector while looping over it?
body: <p>I am looping through a vector with a loop such as <code>for(int i = 0; i &lt; vec.size(); i++)</code>.  Within this loop, I check a condition on the element at that vector index, and if a certain condition is true, I want to delete that element.</p>
  
  <p>How do I delete a vector element while looping over it without crashing?</p>