Dune::GenericIterator< C, T, R, D, IteratorFacade > Class Template Reference
[GenericIterator]

#include <genericiterator.hh>

List of all members.


Detailed Description

template<class C, class T, class R = T&, class D = std::ptrdiff_t, template< class, class, class, class > class IteratorFacade = RandomAccessIteratorFacade>
class Dune::GenericIterator< C, T, R, D, IteratorFacade >

Generic class for stl conformant iterators for container classes with operator[].

If template parameter C has a const qualifier we are a const iterator, otherwise we are a mutable iterator.

Public Types

typedef C Container
 The type of container we are an iterator for.
typedef T Value
 The value type of the iterator.
typedef D DifferenceType
 The type of the difference between two positions.
typedef R Reference
 The type of the reference to the values accessed.

Public Member Functions

 GenericIterator (Container &cont, DifferenceType pos)
 Constructor.
 GenericIterator (const MutableIterator &other)
 Copy constructor.
 GenericIterator (const ConstIterator &other)
 Copy constructor.


Member Typedef Documentation

template<class C, class T, class R = T&, class D = std::ptrdiff_t, template< class, class, class, class > class IteratorFacade = RandomAccessIteratorFacade>
typedef C Dune::GenericIterator< C, T, R, D, IteratorFacade >::Container

The type of container we are an iterator for.

The container type must provide a operator[] method.

If C has a const qualifier we are a const iterator, otherwise we are a mutable iterator.

template<class C, class T, class R = T&, class D = std::ptrdiff_t, template< class, class, class, class > class IteratorFacade = RandomAccessIteratorFacade>
typedef T Dune::GenericIterator< C, T, R, D, IteratorFacade >::Value

The value type of the iterator.

This is the return type of the iterator returned when derefencing.


Constructor & Destructor Documentation

template<class C, class T, class R = T&, class D = std::ptrdiff_t, template< class, class, class, class > class IteratorFacade = RandomAccessIteratorFacade>
Dune::GenericIterator< C, T, R, D, IteratorFacade >::GenericIterator ( Container cont,
DifferenceType  pos 
) [inline]

Constructor.

Parameters:
cont Reference to the container we are an iterator for.
pos The postion the Iterator will be positioned to. (e. g. 0 for an iterator return by Container::begin() or the sizeof the container for an iterator returned by Container::end()

template<class C, class T, class R = T&, class D = std::ptrdiff_t, template< class, class, class, class > class IteratorFacade = RandomAccessIteratorFacade>
Dune::GenericIterator< C, T, R, D, IteratorFacade >::GenericIterator ( const MutableIterator other  )  [inline]

Copy constructor.

This is somehow hard to understand, therefore play with the cases: 1. if we are mutable this is the only valid copy constructor, as the arguments is a mutable iterator 2. if we are a const iterator the argument is a mutable iterator => This is the needed conversion to initialize a const iterator form a mutable one.

template<class C, class T, class R = T&, class D = std::ptrdiff_t, template< class, class, class, class > class IteratorFacade = RandomAccessIteratorFacade>
Dune::GenericIterator< C, T, R, D, IteratorFacade >::GenericIterator ( const ConstIterator other  )  [inline]

Copy constructor.

Warning:
Calling this method results in a compiler error, if this is a mutable iterator.
This is somehow hard to understand, therefore play with the cases: 1. if we are mutable the arguments is a const iterator and therefore calling this method is mistake in the users code and results in a (probably not understandable compiler error 2. If we are a const iterator this is the default copy constructor as the argument is a const iterator too.


The documentation for this class was generated from the following file:

Generated on Thu Apr 2 10:39:54 2009 for dune-common by  doxygen 1.5.6