00001 #ifndef DEREF_ITERATOR_H 00002 #define DEREF_ITERATOR_H 00003 00004 #include "y2storage/AppUtil.h" 00005 00006 template< class Iter, class Value > 00007 class DerefIterator : public Iter 00008 { 00009 public: 00010 typedef Value value_type; 00011 typedef Value& reference; 00012 typedef Value* pointer; 00013 typedef typename Iter::difference_type difference_type; 00014 typedef typename Iter::iterator_category iterator_category; 00015 00016 DerefIterator() {} 00017 00018 DerefIterator( const Iter& i ) : Iter(i) {} 00019 00020 DerefIterator& operator++() { Iter::operator++(); return(*this); } 00021 DerefIterator operator++(int) 00022 { 00023 y2warning( "Expensive ++ DerefIterator" ); 00024 DerefIterator tmp(*this); 00025 Iter::operator++(); 00026 return(tmp); 00027 } 00028 DerefIterator& operator--() { Iter::operator--(); return(*this); } 00029 DerefIterator operator--(int) 00030 { 00031 y2warning( "Expensive -- DerefIterator" ); 00032 DerefIterator tmp(*this); 00033 Iter::operator--(); 00034 return(tmp); 00035 } 00036 00037 reference operator*() const 00038 { 00039 return( *Iter::operator*() ); 00040 } 00041 00042 pointer operator->() const 00043 { 00044 return( Iter::operator*() ); 00045 } 00046 }; 00047 00048 #endif
1.4.4