when will this code not work then? I guess what you mean is that i will actually change right?

say I have these elements in the list: a a b c d

and I do an erase on b, which is index i=2 my code would look like this:

vec.erase(vec.begin()+i);

however, in my for loop if it continues it will next grab index=3 which is now d, skipping the element c.

Is that a correct analysis?

Thanks!