Dune-Fufem 2.11-git
Loading...
Searching...
No Matches
IndexedSliceIterator< BaseIterator, Value > Class Template Reference

An indexed iterator over a slice. More...

#include <dune/fufem/indexedsliceiterator.hh>

Inheritance diagram for IndexedSliceIterator< BaseIterator, Value >:
Inheritance graph

Public Types

typedef std::size_t size_type
 
typedef std::forward_iterator_tag iterator_category
 
typedef typename std::remove_const< V >::type value_type
 
typedef D difference_type
 
typedef V * pointer
 
typedef R reference
 
typedef T DerivedType
 
typedef V Value
 
typedef V * Pointer
 
typedef D DifferenceType
 
typedef R Reference
 

Public Member Functions

 IndexedSliceIterator ()
 
 IndexedSliceIterator (const BaseIterator &it, size_type index, size_type itStride=1, size_type indexStride=1)
 Construct from value and index.
 
Base::Reference dereference () const
 
bool equals (const IndexedSliceIterator &other) const
 
void increment ()
 
size_type index () const
 Get index of iterator.
 
constexpr Reference operator* () const
 
constexpr Pointer operator-> () const
 
constexpr DerivedTypeoperator++ ()
 
constexpr DerivedType operator++ (int)
 

Protected Attributes

BaseIterator it_
 
size_type itStride_
 
size_type index_
 
size_type indexStride_
 

Detailed Description

template<class BaseIterator, class Value>
class IndexedSliceIterator< BaseIterator, Value >

An indexed iterator over a slice.

This class provides an iterator over a slice given by a base iterator and an index() method. Both, the base iterator and the index are incremented by a configurable stride value on incrementing the iterator.

This is not a random access iterator. And indices are in general not consecutive. Instead this can be considered as an iterator over a sparse data set.

Template Parameters
BaseIteratorType of base iterator. Has to provide operator* and prefix operator++. May be a raw pointer.
ValueType of values the iterator iterates over.

Member Typedef Documentation

◆ size_type

template<class BaseIterator , class Value >
typedef std::size_t IndexedSliceIterator< BaseIterator, Value >::size_type

Constructor & Destructor Documentation

◆ IndexedSliceIterator() [1/2]

template<class BaseIterator , class Value >
IndexedSliceIterator< BaseIterator, Value >::IndexedSliceIterator ( )
inline

◆ IndexedSliceIterator() [2/2]

template<class BaseIterator , class Value >
IndexedSliceIterator< BaseIterator, Value >::IndexedSliceIterator ( const BaseIterator &  it,
size_type  index,
size_type  itStride = 1,
size_type  indexStride = 1 
)
inline

Construct from value and index.

An end iterator is created by specifying an appropriate base iterator or index. If itStride is zero to iterators are considered equal if the indices coincide. Otherwise they are considered equal if the base iterators coincide.

Parameters
itUnderlying base iterator
indexInitial index
itStrideOn incrementing the iterator the base iterator is incremented itStride times.
indexStrideOn incrementing the iterator the index is incremented indexStride times.

Member Function Documentation

◆ dereference()

template<class BaseIterator , class Value >
Base::Reference IndexedSliceIterator< BaseIterator, Value >::dereference ( ) const
inline

◆ equals()

template<class BaseIterator , class Value >
bool IndexedSliceIterator< BaseIterator, Value >::equals ( const IndexedSliceIterator< BaseIterator, Value > &  other) const
inline

◆ increment()

template<class BaseIterator , class Value >
void IndexedSliceIterator< BaseIterator, Value >::increment ( )
inline

◆ index()

template<class BaseIterator , class Value >
size_type IndexedSliceIterator< BaseIterator, Value >::index ( ) const
inline

Get index of iterator.

While the indices are strictly increasing but not necessarily consecutive.

Member Data Documentation

◆ index_

template<class BaseIterator , class Value >
size_type IndexedSliceIterator< BaseIterator, Value >::index_
protected

◆ indexStride_

template<class BaseIterator , class Value >
size_type IndexedSliceIterator< BaseIterator, Value >::indexStride_
protected

◆ it_

template<class BaseIterator , class Value >
BaseIterator IndexedSliceIterator< BaseIterator, Value >::it_
protected

◆ itStride_

template<class BaseIterator , class Value >
size_type IndexedSliceIterator< BaseIterator, Value >::itStride_
protected

The documentation for this class was generated from the following file: