C++ Logo

SG20

Advanced search

Subject: Re: A draft paper to fix the range-based for loop to make it teachable
From: Yehezkel Bernat (yehezkelshb_at_[hidden])
Date: 2020-11-10 04:52:49


On Tue, Nov 10, 2020 at 12:49 PM Balog Pal via SG20 <sg20_at_[hidden]>
wrote:

> On 11/10/2020 10:41 AM, Yehezkel Bernat via SG20 wrote:
>
> > 3. IMHO, the best and simplest solution is to use
> > std::ranges::for_each, because it holds the temporary till the end of
> > the loop due to the function call semantics.
>
> There's light and day difference between the simple for() form with the
> direct body and access to break, continue
>

continue is just an early return in the lambda, but yes, I missed the issue
with break. Excellent point!
Thanks



SG20 list run by sg20-owner@lists.isocpp.org

Older Archives on Google Groups