#include
#include
#include
using namespace std;
int main()
{
list vectorObject, vectorObject2;
list::iterator itr;
int i;
for(i = 0; i <5; i++)
vectorObject.push_back(i);
cout << "Original contents of vectorObject: ";
itr = vectorObject.begin();
while(itr != vectorObject.end())
cout << *itr++ << " ";
cout << endl;
front_insert_iterator > frnt_i_itr(vectorObject); // create a front_insert_iterator to vectorObject
*frnt_i_itr++ = 100; // insert rather than overwrite at front
*frnt_i_itr = 200;
cout << "vectorObject after insertion: ";
itr = vectorObject.begin();
while(itr != vectorObject.end())
cout << *itr++ << " ";
cout << endl;
cout << "Size of vectorObject2 before copy: " << vectorObject2.size() << endl;
copy(vectorObject.begin(), vectorObject.end(), front_inserter(vectorObject2));
cout << "Size of vectorObject2 after copy: " << vectorObject2.size() << endl;
cout << "Contents of vectorObject2 after insertion: ";
itr = vectorObject2.begin();
while(itr != vectorObject2.end())
cout << *itr++ << " ";
return 0;
}