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