dune-grid  2.1.1
entityiterator.hh
Go to the documentation of this file.
00001 #ifndef DUNE_GRID_ENTITYITERATOR_HH
00002 #define DUNE_GRID_ENTITYITERATOR_HH
00003 
00004 #include <cstddef>
00005 #include <iterator>
00006 
00007 #include <dune/grid/common/entitypointer.hh>
00008 
00009 namespace Dune
00010 {
00011 
00032   template< int codim, class Grid, class IteratorImp >
00033   class EntityIterator
00034   : public EntityPointer< Grid, IteratorImp >
00035   {
00036     typedef EntityPointer< Grid, IteratorImp > Base;
00037 
00038   protected:
00039     using Base::realIterator;
00040 
00041   public:
00042     typedef typename Grid::template Codim< codim >::Entity Entity;
00043 
00045     EntityIterator &operator++ ()
00046     {
00047       realIterator.increment();
00048       return *this;
00049     }
00050 
00056     EntityIterator ( const IteratorImp &imp )
00057     : Base( imp )
00058     {}
00059 
00061   };
00062 
00063 } // namespace Dune
00064 
00065 namespace std
00066 {
00067 
00068   template< int codim, class Grid, class IteratorImp >
00069   struct iterator_traits< Dune::EntityIterator< codim, Grid, IteratorImp > >
00070   {
00071     typedef ptrdiff_t difference_type;
00072     typedef const typename Dune::EntityIterator< codim, Grid, IteratorImp >::Entity value_type;
00073     typedef value_type *pointer;
00074     typedef value_type &reference;
00075     typedef forward_iterator_tag iterator_category;
00076   };
00077 
00078 } // namespace std
00079 
00080 #endif // #ifndef DUNE_GRID_ENTITYITERATOR_HH