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)
211 GenericIterator(
const MutableIterator& other) : container_(other.container_), position_(other.position_)
223 GenericIterator(
const ConstIterator& other) : container_(other.container_), position_(other.position_)
227 bool equals(
const MutableIterator & other)
const
229 return position_ == other.position_ && container_ == other.container_;
232 bool equals(
const ConstIterator & other)
const
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
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
std::ptrdiff_t DifferenceType
Definition genericiterator.hh:182
reference Reference
Definition genericiterator.hh:187
DifferenceType distanceTo(const MutableIterator &other) const
Definition genericiterator.hh:259
BitSetVector< block_size, Allocator > Container
Definition genericiterator.hh:170
value_type Value
Definition genericiterator.hh:177
DifferenceType distanceTo(const ConstIterator &other) const
Definition genericiterator.hh:265
void decrement()
Definition genericiterator.hh:246
GenericIterator()
Definition genericiterator.hh:190
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:435