C++ Logo

SG20

Advanced search

Subject: Re: A draft paper to fix the range-based for loop to make it teachable
From: Balog Pal (pasa_at_[hidden])
Date: 2020-11-10 04:48:41


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 compared to forcing a lambda. 
for_each may be considered as a workaround but by no means can count as
best or simplest solution -- especially for an artificial problem
planted into the language.

I absolutely want the language to evolve by fixing core facilities to
just work along original intended semantics without gotchas and chapters
to teach.


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

Older Archives on Google Groups