// C++ program to demonstrate the use of list containers #include #include using namespace std; template void showList( list listObject) { //TO DO //Print out the items of the list using an iterator T var1 ; //ok list someList ; //ok int x1 = someList.size() ; // list::iterator vec1_begin1 ; //= listObject.begin() ; class list::iterator vec1_begin = listObject.begin() ; class list::iterator vec1_end = listObject.end() ; for ( ; vec1_begin != vec1_end; ++vec1_begin ) cout << '\t' << *vec1_begin ; cout << '\n'; } int main() { // defining list list listobj{}; //use push_back and push_front to //push some strings. string str1("Sugar" ) ; string str2(" Robinson" ) ; listobj.push_back( str2 ); listobj.push_front( str1 ); //print the list using the //showList function showList ( listobj ) ; return 0; }