13#ifndef DUMUX_COMMON_ENUMERATE_HH
14#define DUMUX_COMMON_ENUMERATE_HH
27template <
typename Range,
28 typename RangeIterator =
decltype(std::begin(std::declval<Range>())),
29 typename =
decltype(std::end(std::declval<Range>()))>
36 bool operator != (
const Iterator & other)
const {
return iter != other.iter; }
37 void operator ++ () { ++i; ++iter; }
38 auto operator * ()
const {
return std::tie(i, *iter); }
44 auto begin() {
return Iterator{ 0, std::begin(iterable) }; }
45 auto end() {
return Iterator{ 0, std::end(iterable) }; }
48 return Iterable{ std::forward<Range>(iterable) };
constexpr bool operator!=(Tag< T1 >, Tag< T2 >)
Definition: tag.hh:38
constexpr auto enumerate(Range &&iterable)
A Python-like enumerate function.
Definition: enumerate.hh:30