If I compile and run the following code with gcc it works fine - and I don't see why this shouldn't. However if I compile and run this peace of code with VC++ it fails and a popup says: "Expression: Vector iterators incompatible"
int main() {
vector<int> v = { 1,2,3,4 };
for(auto it = v.begin(); it != v.end(); )
{
if(*it% 2 == 0)
{
v.erase(it);
}else
{
++it;
}
}
return 0;
}