28 typename TIter = decltype(std::begin(std::declval<T>())),
29 typename = decltype(std::end(std::declval<T>()))>
30 constexpr
auto enumerate(T && iterable)
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); }
41 struct iterable_wrapper
44 auto begin() {
return iterator{ 0, std::begin(iterable) }; }
45 auto end() {
return iterator{ 0, std::end(iterable) }; }
47 return iterable_wrapper{ std::forward<T>(iterable) };