#ifndef T_ITERATOTH #define T_ITERATOTH #include //for exit #include using namespace std; template class t_iterator: public iterator { bool at_end; //true if we have reached end of range T t; const T end; public: t_iterator(): at_end(true), end() {} t_iterator(const T& initial_t, const T& initial_end): at_end(false), t(initial_t), end(initial_end) {} operator*() and operator== as in t_iterator2.h t_iterator& operator++() { if (at_end) { cerr and exit; } if (t == end) { at_end = true; } else { ++t; } return *this; } //etc. }; //etc. #endif