I have to add a new item to the existing object vector.
Although I am aware that an iterator must be used, I am not entirely sure how it operates.
I need to insert a new item by name in the precise index that I found after some searching into an alphabetically sorted vector.
I have this, then.
vector<Person>people;
int index =54;
Person temp;
people.push_back(temp);//insert at end of vector
people.insert(index, temp);//doesnt work for int
Can somebody advise me on how to use an iterator correctly to shift all subsequent objects by one index and put my item at the 54th element of the vector?