Loading...
Searching...
No Matches
Dune::IteratorRange< Iterator, Sentinel > Class Template Reference
Common » Utilities » C++ utilities and backports

Simple range between a begin and an end iterator. More...

`#include <dune/common/iteratorrange.hh>`

## Public Types

typedef Iterator | iterator
| The iterator belonging to this range.
typedef Sentinel | sentinel
| The iterator belonging to this range.
typedef Iterator | const_iterator
| The iterator belonging to this range.

## Public Member Functions

| IteratorRange (const Iterator &begin, const Sentinel &end)
| Constructs an iterator range on [begin,end).
| IteratorRange ()
| Default constructor, relies on iterators being default-constructible.
iterator | begin () const
| Returns an iterator pointing to the begin of the range.
sentinel | end () const
| Returns an iterator pointing past the end of the range.

## Detailed Description

template<typename Iterator, typename Sentinel = Iterator>
class Dune::IteratorRange< Iterator, Sentinel >

Simple range between a begin and an end iterator.

IteratorRange is mainly useful as a lightweight adaptor class when adding support for range-based for loops to existing containers that lack a standard begin(), end() pair of member functions.

This supports to use a different type for the end iterator (a so called sentinel).

Template Parameters

  Iterator | The type of iterator
  Sentinel | The type of the end iterator (default=Iterator)

## Member Typedef Documentation

## const_iterator

template<typename Iterator, typename Sentinel = Iterator>

typedef Iterator Dune::IteratorRange< Iterator, Sentinel >::const_iterator

The iterator belonging to this range.

This typedef is here mainly for compatibility reasons.

## iterator

template<typename Iterator, typename Sentinel = Iterator>

typedef Iterator Dune::IteratorRange< Iterator, Sentinel >::iterator

The iterator belonging to this range.

## sentinel

template<typename Iterator, typename Sentinel = Iterator>

typedef Sentinel Dune::IteratorRange< Iterator, Sentinel >::sentinel

The iterator belonging to this range.

## Constructor & Destructor Documentation

## IteratorRange() [1/2]

template<typename Iterator, typename Sentinel = Iterator>

Dune::IteratorRange< Iterator, Sentinel >::IteratorRange | ( | const Iterator & | begin,
|  | const Sentinel & | end )

inline

Constructs an iterator range on [begin,end).

## IteratorRange() [2/2]

template<typename Iterator, typename Sentinel = Iterator>

Dune::IteratorRange< Iterator, Sentinel >::IteratorRange | ( |  | ) |

inline

Default constructor, relies on iterators being default-constructible.

## Member Function Documentation

## begin()

template<typename Iterator, typename Sentinel = Iterator>

iterator Dune::IteratorRange< Iterator, Sentinel >::begin | ( |  | ) | const

inline

Returns an iterator pointing to the begin of the range.

## end()

template<typename Iterator, typename Sentinel = Iterator>

sentinel Dune::IteratorRange< Iterator, Sentinel >::end | ( |  | ) | const

inline

Returns an iterator pointing past the end of the range.

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

- iteratorrange.hh