25#ifndef DUMUX_COMMON_ENUMERATE_HH
26#define DUMUX_COMMON_ENUMERATE_HH
39template <
typename Range,
40 typename RangeIterator =
decltype(std::begin(std::declval<Range>())),
41 typename =
decltype(std::end(std::declval<Range>()))>
48 bool operator != (
const Iterator & other)
const {
return iter != other.iter; }
49 void operator ++ () { ++i; ++iter; }
50 auto operator * ()
const {
return std::tie(i, *iter); }
56 auto begin() {
return Iterator{ 0, std::begin(iterable) }; }
57 auto end() {
return Iterator{ 0, std::end(iterable) }; }
60 return Iteratable{ std::forward<Range>(iterable) };
constexpr auto enumerate(Range &&iterable)
A Python-like enumerate function.
Definition: enumerate.hh:42
constexpr bool operator!=(Tag< T1 >, Tag< T2 >)
Definition: tag.hh:50