#include #include "list.h" #include using namespace std; template void printContainer( const Iterator & begin, const Iterator & end ) { if( begin == end ) cout << "Empty container." << endl; else { Iterator itr = begin; cout << "Forward: " << *itr++; while( itr != end ) cout << " " << *itr++; cout << endl; cout << "Backwards: "; while( itr != begin ) cout << *--itr << " "; cout << endl; } } int main( ) { List theList; // Note that I am using List, not list; for( int i = 0; i < 10; i++ ) theList.push_back( i ); printContainer( theList.begin( ), theList.end( ) ); printContainer( theList.rbegin( ), theList.rend( ) ); return 0; }