The insert member function uses an iterator, basically a pointer to a location in the vector, as an argument to decide where the new element should be placed. For instance, consider inserting a value somewhere within a integer vector:
Code:
vector<int> intVect;
vector<int>::iterator it;
intVect.push_back(2); // intVect contains 2
intVect.push_back(4); // intVect contains 2, 4
intVect.push_back(6); // intVect contains 2, 4, 6
intVect.push_back(10); // intVect contains 2, 4, 6, 10
it = find(intVect.begin(),intVect.end(),10); // Find the value '10' in vector
it = intVect.insert(it,8); // intVect contains 2, 4, 6, 8, 10
intVect.insert(it,3,7); // intVect contains 2, 4, 6, 7, 7, 7, 8, 10
vector<int> intVect2;
intVect2.push_back(5); // intVect2 contains 5
intVect2.push_back(3); // intVect2 contains 5, 3
it = find(intVect.begin(),intVect.end(),4); // Find the value '4' in intVect
intVect.insert(it,intVect2.begin(),intVect2.end()); // intVect contains 2, 5, 3, 4, 6, 7, 7, 7, 8, 10
Bottomline is with the insert function, you need to provide the position where you wish to insert the value.