C++ Logo

STD-DISCUSSION

Advanced search

Subject: zero-based iota without having to specify literal zero?
From: Matthew Woehlke (mwoehlke.floss_at_[hidden])
Date: 2021-06-03 09:14:43


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

STD-DISCUSSION list run by std-discussion-owner@lists.isocpp.org

Older Archives on Google Groups