Topic: storage class specifier of range-based for's implicit variables


Author: szollosi.lorand@gmail.com
Date: Mon, 10 Oct 2016 12:16:02 -0700 (PDT)
Raw View
------=_Part_814_1740365636.1476126962316
Content-Type: multipart/alternative;
 boundary="----=_Part_815_261318900.1476126962316"

------=_Part_815_261318900.1476126962316
Content-Type: text/plain; charset=UTF-8

Hi,

Range-based for declares a range and two iterator variables as auto&& and
auto, respectively. This is unexpected if you declare your loop variable
static or thread_local. This also means that a stackless coroutine cannot
yield from and return to the middle of the loop - which would be the basic
use case for generators.
I'd suggest to have the range and the two iterator variables have identical
storage class specifier as the loop variable (i.e., range declaration).
This would allow one to switch() / goto into the body of the loop.

Thanks,
-lorro

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/b4823fa0-1240-41be-969e-5b8112dc9dcc%40isocpp.org.

------=_Part_815_261318900.1476126962316
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi,<br><br>Range-based for declares a range and two iterat=
or variables as auto&amp;&amp; and auto, respectively. This is unexpected i=
f you declare your loop variable static or thread_local. This also means th=
at a stackless coroutine cannot yield from and return to the middle of the =
loop - which would be the basic use case for generators.<br>I&#39;d suggest=
 to have the range and the two iterator variables have identical storage cl=
ass specifier as the loop variable (i.e., range declaration). This would al=
low one to switch() / goto into the body of the loop.<br><br>Thanks,<br>-lo=
rro<br></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/b4823fa0-1240-41be-969e-5b8112dc9dcc%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/b4823fa0-1240-41be-969e-5b8112dc9dcc=
%40isocpp.org</a>.<br />

------=_Part_815_261318900.1476126962316--

------=_Part_814_1740365636.1476126962316--

.