The erase operation returns a value. Did you look at the interface for the container function? You need to assign it a new value which is the return value of the erase function. http://cplusplus.com/reference/stl/vector/erase/
To be honest with you, that is a strange loop. I'm not sure why you have the while loop there. Since I don't know what is in the else path, I am not sure what you are trying to do. Bottom line is that "you" must assign something to "it" if you want it to have a value. That is not going to happen automatically.