#include #include #include #include template int max( Iter start, Iter stop ) { int m = *start; while( start != stop ) { if( *start > m ) m = *start; start++; } return m ; } int main() { vector vi(10); for( int i=0;i<10 ; i++ ) vi[i] = 5-i; cout << max( vi.begin(), vi.end() ) << endl; list x; x.insert(x.end(),7); x.insert(x.end(),3); x.insert(x.end(),2); cout << *(x.begin()) << endl; cout << max( x.begin(), x.end() ) << endl; int arr[5] = { 0,2,4,-3,-11}; cout << max( &arr[0], &arr[5] ) << endl; }