14#ifndef RANGES_V3_VIEW_ENUMERATE_HPP
15#define RANGES_V3_VIEW_ENUMERATE_HPP
23#include <range/v3/detail/prologue.hpp>
33 template<
typename Size,
typename Diff>
34 struct index_view : view_facade<index_view<Size, Diff>, infinite>
41 using difference_type = Diff;
55 bool equal(cursor
const & that)
const
57 return that.index_ == index_;
65 index_ +=
static_cast<Size
>(n);
67 Diff distance_to(cursor
const & that)
const
69 return static_cast<Diff
>(
static_cast<Diff
>(that.index_) -
70 static_cast<Diff
>(index_));
76 cursor begin_cursor()
const
80 unreachable_sentinel_t end_cursor()
const
86 index_view() =
default;
91 template<
typename Size,
typename Diff>
92 RANGES_INLINE_VAR
constexpr bool enable_borrowed_range<detail::index_view<Size, Diff>> =
104 template(
typename Rng)(
106 auto operator()(Rng && rng)
const
108 using D = range_difference_t<Rng>;
109 using S = detail::iter_size_t<iterator_t<Rng>>;
110 return zip(detail::index_view<S, D>(), all(
static_cast<Rng &&
>(rng)));
121#include <range/v3/detail/epilogue.hpp>
The viewable_range concept.
Lazily pairs each element in a source range with its corresponding index.
Definition enumerate.hpp:103