C++ Logo


Advanced search

Re: [SG20] A draft paper to fix the range-based for loop to make it teachable

From: Yehezkel Bernat <yehezkelshb_at_[hidden]>
Date: Tue, 10 Nov 2020 12:52:49 +0200
On Tue, Nov 10, 2020 at 12:49 PM Balog Pal via SG20 <sg20_at_[hidden]>

> 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!

Received on 2020-11-10 04:53:08