Erase and resize a vector
Advertisements In the following code, I erase an element (pair of integers) from a vector, and the size after deletion is decremented. But as you can see, printing the vector by index doesn’t look normal. I expect some out-of-range errors at runtime. Isn’t that correct? vector<pair<int, int>> v; v.push_back(make_pair(1, 2)); v.push_back(make_pair(3, 4)); v.push_back(make_pair(5, 6)); cout… Read More Erase and resize a vector