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