5#ifndef DUNE_COMMON_INDEXEDITERATOR_HH
6#define DUNE_COMMON_INDEXEDITERATOR_HH
30 using Traits = std::iterator_traits<Iter>;
31 static_assert(std::is_copy_constructible_v<Iter>);
32 static_assert(std::is_base_of_v<std::forward_iterator_tag, typename Traits::iterator_category>);
39 template <
class I = Iter,
40 std::enable_if_t<std::is_default_constructible_v<I>,
bool> =
true>
42 noexcept(
std::is_nothrow_default_constructible_v<Iter>)
48 noexcept(
std::is_nothrow_copy_constructible_v<Iter>)
76 template <
class I = Iter,
77 decltype(--std::declval<I&>(),
bool{}) =
true>
86 template <
class I = Iter,
87 decltype(std::declval<I&>()--,
bool{}) =
true>
96 template <
class I = Iter,
97 decltype(std::declval<I&>()+=1,
bool{}) =
true>
106 template <
class I = Iter,
107 decltype(std::declval<I&>()-=1,
bool{}) =
true>
Dune namespace.
Definition alignedallocator.hh:13
An iterator mixin that adds an index() method returning an enumeration index for the traversal.
Definition indexediterator.hh:29
constexpr IndexedIterator & operator++()
Increment the iterator and the index.
Definition indexediterator.hh:60
constexpr IndexedIterator & operator--()
Decrement the iterator and the index.
Definition indexediterator.hh:78
constexpr size_type index() const noexcept
Return the enumeration index.
Definition indexediterator.hh:54
constexpr IndexedIterator() noexcept(std::is_nothrow_default_constructible_v< Iter >)
Default constructor default-constructs the Iter base type and the index by 0.
Definition indexediterator.hh:41
constexpr IndexedIterator(Iter it, size_type index=0) noexcept(std::is_nothrow_copy_constructible_v< Iter >)
Definition indexediterator.hh:47
typename Traits::difference_type size_type
Type used for storing the traversal index.
Definition indexediterator.hh:36