I'm walking through a vector using a for loop and each time through I check the object in the vector for a certain criteria. If it fials I want to erase the object and continue on. My question is when I do an erase will that automatically bump every index which comes after that in the for loop down one?
I'm wondering if I erase one element on the next time through the loop will 'i' be pointing at the very next item, or will all the items indexes have automatically moved down and so incrementing 'i' will make me skip an element?
'i' will not be changed, so if i = 5 and you erase myvector[5], the element which was myvector[6] will become myvector[5].
When you perform i++, 'i' will becoce 6 and you will loose that element.
To avoid that either increment 'i' only in an 'else' block, or decrement it in the 'if' block