C++ Logo

std-proposals

Advanced search

Re: count-based for loop

From: Justin Bassett <jbassett271_at_[hidden]>
Date: Thu, 29 Aug 2019 12:04:00 -0700
On Thu, Aug 29, 2019, 10:48 AM Matthew Woehlke via Std-Proposals <
std-proposals_at_[hidden]> wrote:

>
> That reminds me, though... what is wrong with:
>
> for (auto const i : std::iota(x))
>
> ...? (IOW, add a single-argument overload that counts from 0 up to the
> argument?)
>

If it hasn't changed since it's been last updated on cppreference, iota(x)
is an infinite range counting up from x: x, x+1, x+2, ...

--Justin

>

Received on 2019-08-29 14:06:16