#include #include #include #include //for insert_iterator using namespace std; int main() { const int a[] = {10, 30, 40}; const size_t n = sizeof a / sizeof a[0]; vector v(a, a + n); cout << "size == " << v.size() << ", capacity == " << v.capacity() << "\n"; insert_iterator > in(v, v.begin() + 1); //Refer to the 30. *in = 20; //Insert 20 in front of the 30. cout << "size == " << v.size() << ", capacity == " << v.capacity() << "\n"; for (vector::const_iterator it = v.begin(); it != v.end(); ++it) { cout << *it << "\n"; } return EXIT_SUCCESS; }