hello, If I want to insert a value given a certain index, sorry can you tell me what I am missing here. Reading the documentation I was under the impression that this should work:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <iostream>
#include <vector>
usingnamespace std;
int main()
{
vector<int> v {1,2,3,5};
int index = 0;
int value = 9;
//I would expect index 0 to contain value=9
v.insert(v.begin(), index, value);
cout << v.at(0); // this returns 1 still. Not 9.
return 0;
}