Is there a better way of iterating over the indices of a container than doing something like this
for (auto i : view::iota(0, vec.size())
Ideally something that would look just like this view::something(vec)
.
I understand I can write my own function to do this, but was wondering if this functionality already existed. I am also aware of being able to do something like this
for (auto [idx, elm] : view::zip(view::indices, vec))
After some code examination, I have become aware of being able to write this instead view::indices(vec.size())
, however even though indices
has ptrdiff_t
as a default, using size()
results in it producing size_t
, and I would rather retain the ptrdiff_t
.