Dune Core Modules (unstable)
An iterator mixin that adds an index()
method returning an enumeration index for the traversal.
More...
#include <dune/common/indexediterator.hh>
Public Types | |
using | size_type = typename Traits::difference_type |
Type used for storing the traversal index. | |
Public Member Functions | |
template<class I = Iter, std::enable_if_t< std::is_default_constructible_v< I >, bool > = true> | |
constexpr | IndexedIterator () noexcept(std::is_nothrow_default_constructible_v< Iter >) |
Default constructor default-constructs the Iter base type and the index by 0. | |
constexpr | IndexedIterator (Iter it, size_type index=0) noexcept(std::is_nothrow_copy_constructible_v< Iter >) |
constexpr size_type | index () const noexcept |
Return the enumeration index. | |
constexpr IndexedIterator & | operator++ () |
Increment the iterator and the index. | |
constexpr IndexedIterator | operator++ (int) |
Increment the iterator and the index. | |
template<class I = Iter, decltype(--std::declval< I & >(), bool{}) = true> | |
constexpr IndexedIterator & | operator-- () |
Decrement the iterator and the index. | |
template<class I = Iter, decltype(std::declval< I & >() --, bool{}) = true> | |
constexpr IndexedIterator | operator-- (int) |
Decrement the iterator and the index. | |
template<class I = Iter, decltype(std::declval< I & >()+=1, bool{}) = true> | |
constexpr IndexedIterator & | operator+= (typename Iter::difference_type n) |
Increment the iterator and the index. | |
template<class I = Iter, decltype(std::declval< I & >() -=1, bool{}) = true> | |
constexpr IndexedIterator & | operator-= (typename Iter::difference_type n) |
Decrement the iterator and the index. | |
Detailed Description
class Dune::IndexedIterator< Iter >
An iterator mixin that adds an index()
method returning an enumeration index for the traversal.
This is a mixin class that derives from its template parameter Iter
and adds the method index()
to retrieve an enumeration index during traversal. Only the increment and decrement operators are adapted to also increment (decrement) the accompanying index in the same way the iterator is incremented or decremented. Especially the dereference and comparison operators are not modified by this mixin class.
- Template Parameters
-
Iter An iterator type from which the IndexedIterator
will be derived.
Constructor & Destructor Documentation
◆ IndexedIterator()
|
inlineconstexprnoexcept |
Construct the Iter
base type by it
and the index by the given starting index. Note that this constructor allows implicit conversion from Iter
type.
The documentation for this class was generated from the following file:
- dune/common/indexediterator.hh