What happens when you attempt to compile and run the following code?
#include <deque>
#include <vector>
#include <iostream>
using namespace std;
int main ()
{
int t[] = {1, 2 ,3 ,4 ,5, 6 , 7, 8 , 9, 10};
vector<int>v1(t, t+10);
deque<int>d1(t, t+10);
vector<int>::iterator it1 = v1.begin();
deque<int>::iterator it2 = d1.begin();
d1.erase(it2+5);
it2 = d1.begin();
cout<<*(it2+5)<<" ";
v1.erase(it1+5);
it1 = v1.begin();
cout<<*(it1+5)<<endl;
}
Comments