3 #ifndef DUNE_GENERICITERATOR_HH 4 #define DUNE_GENERICITERATOR_HH 147 template<
class C,
class T,
class R=T&,
class D = std::ptrdiff_t,
150 public IteratorFacade<GenericIterator<C,T,R,D,IteratorFacade>,T,R,D>
153 friend class
GenericIterator<const typename std::remove_const<C>::type, const typename std::remove_const<T>::type, typename const_reference<R>::type, D, IteratorFacade>;
155 typedef
GenericIterator<typename std::remove_const<C>::type, typename std::remove_const<T>::type, typename mutable_reference<R>::type, D, IteratorFacade>
MutableIterator;
156 typedef
GenericIterator<const typename std::remove_const<C>::type, const typename std::remove_const<T>::type, typename const_reference<R>::type, D, IteratorFacade>
ConstIterator;
199 : container_(&cont), position_(pos)
227 return position_ == other.position_ && container_ == other.container_;
232 return position_ == other.position_ && container_ == other.container_;
236 return container_->operator[](position_);
250 return container_->operator[](position_+i);
254 position_=position_+n;
259 assert(other.container_==container_);
260 return other.position_ - position_;
265 assert(other.container_==container_);
266 return other.position_ - position_;
const R & type
Definition: genericiterator.hh:98
const R & type
Definition: genericiterator.hh:104
R type
Definition: genericiterator.hh:121
R type
Definition: genericiterator.hh:115
void advance(DifferenceType n)
Definition: genericiterator.hh:253
T Value
The value type of the iterator.
Definition: genericiterator.hh:175
Reference dereference() const
Definition: genericiterator.hh:235
Get the 'const' version of a reference to a mutable object.
Definition: genericiterator.hh:84
Generic class for stl-conforming iterators for container classes with operator[]. ...
Definition: genericiterator.hh:149
R Reference
The type of the reference to the values accessed.
Definition: genericiterator.hh:185
Definition: typetraits.hh:95
GenericIterator(const MutableIterator &other)
Copy constructor.
Definition: genericiterator.hh:209
Dune namespace.
Definition: alignment.hh:10
DifferenceType distanceTo(const MutableIterator &other) const
Definition: genericiterator.hh:257
const R type
Definition: genericiterator.hh:92
GenericIterator(Container &cont, DifferenceType pos)
Constructor.
Definition: genericiterator.hh:198
This file implements iterator facade classes for writing stl conformant iterators.
GenericIterator(const ConstIterator &other)
Copy constructor.
Definition: genericiterator.hh:221
bool equals(const ConstIterator &other) const
Definition: genericiterator.hh:230
void increment()
Definition: genericiterator.hh:239
Base class for stl conformant forward iterators.
Definition: iteratorfacades.hh:427
get the 'mutable' version of a reference to a const object
Definition: genericiterator.hh:113
DifferenceType distanceTo(const ConstIterator &other) const
Definition: genericiterator.hh:263
R & type
Definition: genericiterator.hh:133
const R type
Definition: genericiterator.hh:86
C Container
The type of container we are an iterator for.
Definition: genericiterator.hh:168
bool equals(const MutableIterator &other) const
Definition: genericiterator.hh:225
R & type
Definition: genericiterator.hh:127
D DifferenceType
The type of the difference between two positions.
Definition: genericiterator.hh:180
Reference elementAt(DifferenceType i) const
Definition: genericiterator.hh:249
void decrement()
Definition: genericiterator.hh:244