First page Back Continue Last page Graphics
erase (cont.)
Once we remove an element from the vector, the vector now has one fewer element than it did before.
In addition to removing the element, the vector must move all the remaining elements back to take up the missing space.
Since i already points to the next element, we must not increment it in this path.
Note, we call students.size() each time to be sure we account for this reduction if it occurs.