C++ Logo

sg10

Advanced search

Re: [isocpp-core] draft new wording for fixing the range-based for loop (D2644R1)

From: Arthur O'Dwyer <arthur.j.odwyer_at_[hidden]>
Date: Thu, 17 Nov 2022 11:14:19 -0500
I agree with Matthias's rationale for having a feature-test macro.
+1 for bumping the value of __cpp_range_based_for.
(We've also bumped its value once before, when it was extended to handle
non-common ranges, and the lifetime thing is *at least* as big a new
feature as handling non-common ranges in for loops.)

–Arthur


On Thu, Nov 17, 2022 at 4:41 AM Matthias Kretz via Core <
core_at_[hidden]> wrote:

> On Wednesday, 16 November 2022 22:54:51 CET Barry Revzin via Core wrote:
> > We have
> >
> https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommenda
> > tions#__cpp_range_based_for already so we might as well bump it.
> >
> > I'm not sure what you would actually do with the information tho -
> there's
> > not really any benefit to writing the loop two ways, just write it the
> way
> > that works.
>
> #if __cpp_range_based_for <= 201603
> #error "Your compiler is not supported."
> #endif
>
> I believe it's a valid approach to require the simpler lifetime rules and
> stop
> thinking about temporaries when using range-based for.
>
> --
> ──────────────────────────────────────────────────────────────────────────
> Dr. Matthias Kretz https://mattkretz.github.io
> GSI Helmholtz Centre for Heavy Ion Research https://gsi.de
> stdₓ::simd
> ──────────────────────────────────────────────────────────────────────────
> _______________________________________________
> Core mailing list
> Core_at_lists.isocpp.org
> Subscription: https://lists.isocpp.org/mailman/listinfo.cgi/core
> Link to this post: http://lists.isocpp.org/core/2022/11/13578.php
>

Received on 2022-11-17 16:14:32