// ---------------------------------------------------------------------- // // iter8or.cc - Do s have all required template arguments? // // History: // 29-Sep-2000 WEB Initial draft // 26-Feb-2001 WEB Enable cure via replacement // 25-Apr-2001 WEB s//"ISOcxx\/ISOcxxSyntax.hh"/ // // ---------------------------------------------------------------------- #include "ISOcxx/ISOcxxSyntax.hh" #include class int_iter : public std::ISOcxxIterator< std::forward_iterator_tag // category , int // value_type , ptrdiff_t // difference_type , int * // pointer , int & // reference > { public: int_iter() : p( 0 ) {} int_iter( int_iter const & it ) : p( it.p ) {} int_iter( pointer it ) : p( it ) {} reference operator * () { return *p; } pointer & operator -> () { return p; } bool operator == ( int_iter const & rhs ) const { return p == rhs.p; } bool operator != ( int_iter const & rhs ) const { return p != rhs.p; } bool operator == ( pointer rhs ) const { return p == rhs; } bool operator != ( pointer rhs ) const { return p != rhs; } int_iter & operator ++ () { ++p; return *this; } int_iter operator ++ (int) { int_iter tmp(*this); ++p; return tmp; } private: pointer p; }; // int_iter int main() { int const N = 10; int c[N]; for ( int_iter it = c+0; it != c+N; ++ it ) *it = 0; return c[N-1]; } // main()