//vectors.cpp
#include <iostream>
#include <vector>
using namespace std;
int main()
{
	int	list1 [5] = {0,1,2,3,4},
		list2 [5];

	vector<int> 	v1(5),	//v(5) equivalent to list[5]
			v2(5);
			
	//vector<int>    v(5) = {0,1,2,3,4}    ILLEGAL

	for (int k=0; k <5; k++)	//vector<int> v1(list1, list1 + 5);    is EQUIVALENT.
	{				//It initializes v1 to share the values of list1;
		v1 [k] = k;		//i.e, from the value pointed to by list1
	}				//up to and including the value pointed to by list1 + 4.
	
	v2 = v1;	// ==> LEGAL
	// list2 = list1; ==> ILLEGAL!

	// Prints out the values stored in the lists
	for (int j=0; j < 5; j++)
	{
		cout 	<< "list1 [" << j << "] = "
			<< list1[j] << endl;
		cout 	<< "v1 [" << j << "] = "
			<< v1 [j] << endl;
		cout 	<< "v2 [" << j << "] = "
			<< v2 [j] << endl;
		cout	<< endl;
	}
	return 0;
}
