5#ifndef DUNE_GENERICITERATOR_HH
6#define DUNE_GENERICITERATOR_HH
149 template<
class C,
class T,
class R=T&,
class D = std::ptrdiff_t,
152 public IteratorFacade<GenericIterator<C,T,R,D,IteratorFacade>,T,R,D>
155 friend class
GenericIterator<const typename std::remove_const<C>::type, const typename std::remove_const<T>::type, typename const_reference<R>::type, D, IteratorFacade>;
157 typedef
GenericIterator<typename std::remove_const<C>::type, typename std::remove_const<T>::type, typename mutable_reference<R>::type, D, IteratorFacade>
MutableIterator;
158 typedef
GenericIterator<const typename std::remove_const<C>::type, const typename std::remove_const<T>::type, typename const_reference<R>::type, D, IteratorFacade>
ConstIterator;
201 : container_(&cont), position_(pos)
229 return position_ == other.position_ && container_ == other.container_;
234 return position_ == other.position_ && container_ == other.container_;
238 return container_->operator[](position_);
252 return container_->operator[](position_+i);
256 position_=position_+n;
261 assert(other.container_==container_);
262 return other.position_ - position_;
267 assert(other.container_==container_);
268 return other.position_ - position_;
This file implements iterator facade classes for writing stl conformant iterators.
Dune namespace.
Definition alignedallocator.hh:13
Get the 'const' version of a reference to a mutable object.
Definition genericiterator.hh:87
const R type
Definition genericiterator.hh:88
const R type
Definition genericiterator.hh:94
const R & type
Definition genericiterator.hh:100
const R & type
Definition genericiterator.hh:106
get the 'mutable' version of a reference to a const object
Definition genericiterator.hh:116
R type
Definition genericiterator.hh:117
R type
Definition genericiterator.hh:123
R & type
Definition genericiterator.hh:129
Generic class for stl-conforming iterators for container classes with operator[].
Definition genericiterator.hh:153
GenericIterator(const MutableIterator &other)
Copy constructor.
Definition genericiterator.hh:211
bool equals(const MutableIterator &other) const
Definition genericiterator.hh:227
Reference elementAt(DifferenceType i) const
Definition genericiterator.hh:251
void increment()
Definition genericiterator.hh:241
GenericIterator(const ConstIterator &other)
Copy constructor.
Definition genericiterator.hh:223
void advance(DifferenceType n)
Definition genericiterator.hh:255
GenericIterator(Container &cont, DifferenceType pos)
Constructor.
Definition genericiterator.hh:200
D DifferenceType
The type of the difference between two positions.
Definition genericiterator.hh:182
R Reference
The type of the reference to the values accessed.
Definition genericiterator.hh:187
DifferenceType distanceTo(const MutableIterator &other) const
Definition genericiterator.hh:259
C Container
The type of container we are an iterator for.
Definition genericiterator.hh:170
T Value
The value type of the iterator.
Definition genericiterator.hh:177
DifferenceType distanceTo(const ConstIterator &other) const
Definition genericiterator.hh:265
void decrement()
Definition genericiterator.hh:246
Reference dereference() const
Definition genericiterator.hh:237
bool equals(const ConstIterator &other) const
Definition genericiterator.hh:232
Base class for stl conformant forward iterators.
Definition iteratorfacades.hh:434