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_;
This file implements iterator facade classes for writing stl conformant iterators.
Dune namespace.
Definition alignment.hh:11
Get the 'const' version of a reference to a mutable object.
Definition genericiterator.hh:85
const R type
Definition genericiterator.hh:86
const R type
Definition genericiterator.hh:92
const R & type
Definition genericiterator.hh:98
const R & type
Definition genericiterator.hh:104
get the 'mutable' version of a reference to a const object
Definition genericiterator.hh:114
R type
Definition genericiterator.hh:115
R type
Definition genericiterator.hh:121
R & type
Definition genericiterator.hh:127
Generic class for stl-conforming iterators for container classes with operator[].
Definition genericiterator.hh:151
GenericIterator(const MutableIterator &other)
Copy constructor.
Definition genericiterator.hh:209
bool equals(const MutableIterator &other) const
Definition genericiterator.hh:225
Reference elementAt(DifferenceType i) const
Definition genericiterator.hh:249
void increment()
Definition genericiterator.hh:239
GenericIterator(const ConstIterator &other)
Copy constructor.
Definition genericiterator.hh:221
void advance(DifferenceType n)
Definition genericiterator.hh:253
GenericIterator(Container &cont, DifferenceType pos)
Constructor.
Definition genericiterator.hh:198
D DifferenceType
The type of the difference between two positions.
Definition genericiterator.hh:180
R Reference
The type of the reference to the values accessed.
Definition genericiterator.hh:185
DifferenceType distanceTo(const MutableIterator &other) const
Definition genericiterator.hh:257
C Container
The type of container we are an iterator for.
Definition genericiterator.hh:168
T Value
The value type of the iterator.
Definition genericiterator.hh:175
DifferenceType distanceTo(const ConstIterator &other) const
Definition genericiterator.hh:263
void decrement()
Definition genericiterator.hh:244
Reference dereference() const
Definition genericiterator.hh:235
bool equals(const ConstIterator &other) const
Definition genericiterator.hh:230
Base class for stl conformant forward iterators.
Definition iteratorfacades.hh:433
Definition typetraits.hh:74