#include <iostream>
#include <vector>
using namespace std;
int main()
{
vector<int> v(10,0);
vector<int>::iterator ff = v.begin();
v.assign(3, 11);
cout << *ff << endl;
cin.get();
return 0;
return 0;
}
guess:
something in compiler wrong? something i don't know?
details:
when i see assign that the function of vector in c++ api. by chance i want know allocated storage space in vector and whether can use iterator as pointer. so i write this . but it wrong . i think maybe when in call assign it reallocation memory. but i google it .it said
"This causes an automatic reallocation of the allocated storage space if -and only if- the new vector size surpasses the current vector capacity."
obvious the capabilities is big so it should not reallocation.i am crazy ,and i try devc++ and it good .why?