C++ Logo

std-discussion

Advanced search

zero-based iota without having to specify literal zero?

From: Matthew Woehlke <mwoehlke.floss_at_[hidden]>
Date: Thu, 3 Jun 2021 10:14:43 -0400
While having a discussion with a coworker w.r.t. this:

   for (auto i : magic(foo.size()) // replace i=0; i<size; ++i

...I was reminded again about std::views::iota... and how it
unfortunately requires specifying the initial value.

Is there really still no direct standard library implementation of
`magic`? Has one been proposed? (If not, would we be interested in such
a proposal?)

(Note: I've implemented `magic` in my own libraries I believe three
times now.)

-- 
Matthew

Received on 2021-06-03 09:14:47