|
dune-common 2.12-git
|
Generic class for stl-conforming iterators for container classes with operator[]. More...
#include <dune/common/genericiterator.hh>

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 () | |
| GenericIterator (Container &cont, DifferenceType pos) | |
| Constructor. | |
| GenericIterator (const MutableIterator &other) | |
| Copy constructor. | |
| GenericIterator (const ConstIterator &other) | |
| Copy constructor. | |
| bool | equals (const MutableIterator &other) const |
| bool | equals (const ConstIterator &other) const |
| Reference | dereference () const |
| void | increment () |
| void | decrement () |
| Reference | elementAt (DifferenceType i) const |
| void | advance (DifferenceType n) |
| DifferenceType | distanceTo (const MutableIterator &other) const |
| DifferenceType | distanceTo (const ConstIterator &other) const |
Detailed Description
class Dune::GenericIterator< C, T, R, D, IteratorFacade >
Generic class for stl-conforming 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.
Member Typedef Documentation
◆ Container
| typedef C Dune::GenericIterator< C, T, R, D, IteratorFacade >::Container |
The type of container we are an iterator for.
The container type must provide an operator[] method.
If C has a const qualifier we are a const iterator, otherwise we are a mutable iterator.
◆ DifferenceType
| typedef D Dune::GenericIterator< C, T, R, D, IteratorFacade >::DifferenceType |
The type of the difference between two positions.
◆ Reference
| typedef R Dune::GenericIterator< C, T, R, D, IteratorFacade >::Reference |
The type of the reference to the values accessed.
◆ Value
| typedef T Dune::GenericIterator< C, T, R, D, IteratorFacade >::Value |
The value type of the iterator.
This is the return type when dereferencing the iterator.
Constructor & Destructor Documentation
◆ GenericIterator() [1/4]
|
inline |
◆ GenericIterator() [2/4]
|
inline |
Constructor.
- Parameters
-
cont Reference to the container we are an iterator for pos The position the iterator will be positioned to (e.g. 0 for an iterator returned by Container::begin() or the size of the container for an iterator returned by Container::end()
◆ GenericIterator() [3/4]
|
inline |
Copy constructor.
This is somehow hard to understand, therefore play with the cases:
- if we are mutable this is the only valid copy constructor, as the argument is a mutable iterator
- if we are a const iterator the argument is a mutable iterator => This is the needed conversion to initialize a const iterator from a mutable one.
◆ GenericIterator() [4/4]
|
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:
- if we are mutable the arguments is a const iterator and therefore calling this method is mistake in the user's code and results in a (probably not understandable) compiler error
- If we are a const iterator this is the default copy constructor as the argument is a const iterator too.
Member Function Documentation
◆ advance()
|
inline |
◆ decrement()
|
inline |
◆ dereference()
|
inline |
◆ distanceTo() [1/2]
|
inline |
◆ distanceTo() [2/2]
|
inline |
◆ elementAt()
|
inline |
◆ equals() [1/2]
|
inline |
◆ equals() [2/2]
|
inline |
◆ increment()
|
inline |
Friends And Related Symbol Documentation
◆ GenericIterator< const typename std::remove_const< C >::type, const typename std::remove_const< T >::type, typename const_reference< R >::type, D, IteratorFacade >
|
friend |
◆ GenericIterator< typename std::remove_const< C >::type, typename std::remove_const< T >::type, typename mutable_reference< R >::type, D, IteratorFacade >
|
friend |
The documentation for this class was generated from the following file:
Legal Statements / Impressum | Hosted by TU Dresden & Uni Heidelberg | Generated by
1.9.8