I have a quick question that's giving me some grief. As part of a much larger project, I want to scan a vector for elements that are 0 and, when I find them, delete them. I'm curious as to why the following is alright:
if (playerVec[5] == 0)
But this is not:
for(vector<Player>::iterator it = playerVec.begin(); it != playerVec.end(); ++it) {
if(playerVec[it] == 0) { //Invalid if condition
}
I assume it has to do with the factor that it is an iterator, but how else could I approach the deletion within a for loop? Do I need another variable for indexing?