I declared a vector of constant integers, but its element can be changed.
vector<const int> v;
int a = 5;
v.push_back(a);
v[0] = 8;
cout << "Vector elements:" << endl;
for( size_t i=0; i<v.size(); i++){
cout << v[i] << ' ';
}
cout << endl;
The output is
Vector elements:
8
I think the element should not be able to change because it is a constant. Can anybody let me know what I am missing here?
I am using Visual Studio 2012 on Windows 7.
Thanks in advance!