#include #include #include #include #include #include using namespace std; template void PrintContainer(string strTitle, Container &cont); int main() { int pArray[5] = {9,1,4,7,2}; list l; copy(pArray, pArray+5, front_inserter(l)); PrintContainer("..",l); vector v; for(int i=0;i<5;i++) back_inserter(v) = pArray[i]; PrintContainer("..", v); set s; copy(pArray,pArray+5,inserter(s,s.begin())); PrintContainer("..", s); return 0; } template void PrintContainer(string strTitle, Container &cont) { cout << strTitle << ":"; for(Container::iterator it = cont.begin(); it != cont.end(); ++it) { cout.width(3); cout << *it; cout << endl; }