#include <iostream>
#include <cstdlib>
#include <vector>
#include <iterator>   //for insert_iterator
using namespace std;

int main()
{
	const int a[] = {10, 30, 40};
	const size_t n = sizeof a / sizeof a[0];
	vector<int> v(a, a + n);

	cout << "size == " << v.size() << ", capacity == " << v.capacity() << "\n";
	insert_iterator<vector<int> > 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<int>::const_iterator it = v.begin(); it != v.end(); ++it) {
		cout << *it << "\n";
	}

	return EXIT_SUCCESS;
}