Topic: Extend the range-based for statement
Author: Antonio Perez <antonio@perezexcelsior.com>
Date: Sun, 7 Aug 2016 13:49:19 -0700 (PDT)
Raw View
------=_Part_708_1013102323.1470602959808
Content-Type: multipart/alternative;
boundary="----=_Part_709_2041747766.1470602959809"
------=_Part_709_2041747766.1470602959809
Content-Type: text/plain; charset=UTF-8
Currently, the range-based for statement, defined in section 6.5.4 of the
C++ international Standard, is defined as follows:
The range-based for statement
for ( for-range-declaration : for-range-initializer ) statement
is equivalent to
{
auto &&__range = for-range-initializer ;
auto __begin = begin-expr ;
auto __end = end-expr ;
for ( ; __begin != __end; ++__begin ) {
for-range-declaration = *__begin;
statement
}
}
I propose that the range-based for statement is expanded to allow iteration
through multiple for-range-initializes simultaneously, with
for ( for-range-declaration : for-range-initializer;
for-range-declaration2 : for-range-initializer2 /*; ...*/) statement
being equivalent to:
{
auto &&__range = for-range-initializer ;
auto &&__range2 = for-range-initializer2 ;
auto __begin = begin-expr ;
auto __begin2 = begin-expr2;
auto __end = end-expr ;
auto __end2 = end-expr2 ;
for ( ; __begin != __end && __begin2 != __end2; ++__begin, ++__begin2 )
{
for-range-declaration = *__begin;
for-range-declaration2 = *__begin2;
statement
}
}
This change would make the range-based for statement more useful and more
versatile
--
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/152c8499-aa2f-4e23-aeec-cd055f06a6da%40isocpp.org.
------=_Part_709_2041747766.1470602959809
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Currently, the range-based for statement, defined in secti=
on 6.5.4 of the C++ international Standard, is defined as follows:<div><br>=
</div><div><div>=C2=A0The range-based for statement</div><div><div class=3D=
"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: bre=
ak-word; background-color: rgb(250, 250, 250);"><code class=3D"prettyprint"=
><div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled=
-by-prettify">for</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">(<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">for</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">-</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">range</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">-</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify">declaration </span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">:</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">for</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">-</span><span style=3D"color: #000;" class=3D"styled-by-prettify">range</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">-</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">initializer </span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> statement</span></div></cod=
e></div></div><div>is equivalent to</div><div></div></div><div class=3D"pre=
ttyprint" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-w=
ord; background-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><di=
v class=3D"subprettyprint"><span style=3D"color: #660;" class=3D"styled-by-=
prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">auto</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&&=
amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">__rang=
e </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">for</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">-</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify">range</span><span style=3D"color: #660;"=
class=3D"styled-by-prettify">-</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify">initializer </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">auto</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> __begin </span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>begin</span><span style=3D"color: #660;" class=3D"styled-by-prettify">-</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify">expr </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">auto</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> __end </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">end</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">-</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">expr </span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">for</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> __begin </span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">!=3D</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> __end</span><span style=3D"color: #660;"=
class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">++</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">__begin </span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">for=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">-</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify">range</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">-</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">declaration </span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color:=
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">*</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">__begin</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 statement<br>=C2=A0 =C2=A0 </span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">}</span></div></code></div><br>I p=
ropose that the range-based for statement is expanded to allow iteration th=
rough multiple for-range-initializes simultaneously, with<div><span class=
=3D"styled-by-prettify" style=3D"font-family: monospace; color: rgb(0, 0, 1=
36); background-color: rgb(250, 250, 250);">for</span><span class=3D"styled=
-by-prettify" style=3D"font-family: monospace; color: rgb(0, 0, 0); backgro=
und-color: rgb(250, 250, 250);">=C2=A0</span><span class=3D"styled-by-prett=
ify" style=3D"font-family: monospace; color: rgb(102, 102, 0); background-c=
olor: rgb(250, 250, 250);">(</span><span class=3D"styled-by-prettify" style=
=3D"font-family: monospace; color: rgb(0, 0, 0); background-color: rgb(250,=
250, 250);">=C2=A0</span><span class=3D"styled-by-prettify" style=3D"font-=
family: monospace; color: rgb(0, 0, 136); background-color: rgb(250, 250, 2=
50);">for</span><span class=3D"styled-by-prettify" style=3D"font-family: mo=
nospace; color: rgb(102, 102, 0); background-color: rgb(250, 250, 250);">-<=
/span><span class=3D"styled-by-prettify" style=3D"font-family: monospace; c=
olor: rgb(0, 0, 0); background-color: rgb(250, 250, 250);">range</span><spa=
n class=3D"styled-by-prettify" style=3D"font-family: monospace; color: rgb(=
102, 102, 0); background-color: rgb(250, 250, 250);">-</span><span class=3D=
"styled-by-prettify" style=3D"font-family: monospace; color: rgb(0, 0, 0); =
background-color: rgb(250, 250, 250);">declaration=C2=A0</span><span class=
=3D"styled-by-prettify" style=3D"font-family: monospace; color: rgb(102, 10=
2, 0); background-color: rgb(250, 250, 250);">:</span><span class=3D"styled=
-by-prettify" style=3D"font-family: monospace; color: rgb(0, 0, 0); backgro=
und-color: rgb(250, 250, 250);">=C2=A0</span><span class=3D"styled-by-prett=
ify" style=3D"font-family: monospace; color: rgb(0, 0, 136); background-col=
or: rgb(250, 250, 250);">for</span><span class=3D"styled-by-prettify" style=
=3D"font-family: monospace; color: rgb(102, 102, 0); background-color: rgb(=
250, 250, 250);">-</span><span class=3D"styled-by-prettify" style=3D"font-f=
amily: monospace; color: rgb(0, 0, 0); background-color: rgb(250, 250, 250)=
;">range</span><span class=3D"styled-by-prettify" style=3D"font-family: mon=
ospace; color: rgb(102, 102, 0); background-color: rgb(250, 250, 250);">-</=
span><span class=3D"styled-by-prettify" style=3D"font-family: monospace; co=
lor: rgb(0, 0, 0); background-color: rgb(250, 250, 250);">initializer; for-=
range-declaration2=C2=A0: for-range-initializer2 /*; ...*/</span><span clas=
s=3D"styled-by-prettify" style=3D"font-family: monospace; color: rgb(102, 1=
02, 0); background-color: rgb(250, 250, 250);">)</span><span class=3D"style=
d-by-prettify" style=3D"font-family: monospace; color: rgb(0, 0, 0); backgr=
ound-color: rgb(250, 250, 250);">=C2=A0statement</span><br></div><div>being=
equivalent to:</div><div><div class=3D"prettyprint" style=3D"border: 1px s=
olid rgb(187, 187, 187); word-wrap: break-word; background-color: rgb(250, =
250, 250);"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span=
style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span =
style=3D"color: #008;" class=3D"styled-by-prettify">auto</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">&&</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify">__range </span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">for</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">-</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">range</span><span style=3D"color: #660;" class=3D"styled-by-prettify">-=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify">initialize=
r </span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0=
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">&&</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify">__range2 </span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">for</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">-</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify">range</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">-</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">initializer2</span><font color=3D"#666600"><span style=3D"color: #000;"=
class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">;</span></font><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">auto</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> __begin </span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">begin</span><span style=3D"color: #660;" class=3D"styled-by-prettify">-=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify">expr </spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span=
><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</span><span=
style=3D"color: #000;" class=3D"styled-by-prettify"> __begin2 </span><span=
style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">begin</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">-</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">expr2</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">auto</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> __end </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">end</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">-</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify">expr </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">auto</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> __end2 </span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">end</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">-</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">expr2 </span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">for</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> __begin </span><span style=3D"color:=
#660;" class=3D"styled-by-prettify">!=3D</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> __end </span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">&&</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> __begin2 </span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">!=3D</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> __end2</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">++</span><span style=3D"color: #000;" class=3D"styled-by-prettify">__beg=
in</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">++</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">__begin2 </span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:=
#008;" class=3D"styled-by-prettify">for</span><span style=3D"color: #660;"=
class=3D"styled-by-prettify">-</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify">range</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">-</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify">declaration </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">*</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">__begin</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">for</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">-</span><span=
style=3D"color: #000;" class=3D"styled-by-prettify">range</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">-</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">declaration2 </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">*</span><font color=3D"#000000"><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">__begin2</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">;</span></font><span style=3D"color:=
#000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 statem=
ent<br>=C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></=
div></code></div><br></div><div>This change would make the range-based for =
statement more useful and more versatile=C2=A0</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/152c8499-aa2f-4e23-aeec-cd055f06a6da%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/152c8499-aa2f-4e23-aeec-cd055f06a6da=
%40isocpp.org</a>.<br />
------=_Part_709_2041747766.1470602959809--
------=_Part_708_1013102323.1470602959808--
.
Author: "D. B." <db0451@gmail.com>
Date: Sun, 7 Aug 2016 22:12:12 +0100
Raw View
--001a113d9d16e12749053981c0bc
Content-Type: text/plain; charset=UTF-8
Simultaneously? As in, each range must have identical size, and they are at
the same index for each iteration?
Or did you really mean sequentially, i.e. it would basically stitch the
ranges together then iterate the result?
Either way, can you show an example of code that currently you feel is
overly hard to express without this ability?
--
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/CACGiwhEnVkeTZxZLJypo%2BWJDZ2OqinXjF0JEUdH8_iFJqyL3Bg%40mail.gmail.com.
--001a113d9d16e12749053981c0bc
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div><div>Simultaneously? As in, each range must have iden=
tical size, and they are at the same index for each iteration?<br><br></div=
>Or did you really mean sequentially, i.e. it would basically stitch the ra=
nges together then iterate the result?<br><br></div>Either way, can you sho=
w an example of code that currently you feel is overly hard to express with=
out this ability?<br><br></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CACGiwhEnVkeTZxZLJypo%2BWJDZ2OqinXjF0=
JEUdH8_iFJqyL3Bg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CACGiwhEnVkeTZx=
ZLJypo%2BWJDZ2OqinXjF0JEUdH8_iFJqyL3Bg%40mail.gmail.com</a>.<br />
--001a113d9d16e12749053981c0bc--
.
Author: "D. B." <db0451@gmail.com>
Date: Sun, 7 Aug 2016 22:16:53 +0100
Raw View
--001a114be8fea75abb053981d131
Content-Type: text/plain; charset=UTF-8
....sorry, I didn't read closely enough the first time. So you definitely
mean simultaneously.
I'm not sure this fits the intended model of range-for, as it would really
require all ranges to have identical numbers of elements, whereas the point
of range-for is that you don't care about how many elements you have or
which index you're currently at - you just want to do something for them
all.
If the situation you want this for is e.g. copying from source to
destination pointers, then I think that idiom is so well-established that
it wouldn't suffice as a justification for this, and if anything, it might
look more obfuscated with this sort of range-for.
But I might be wrong...
--
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/CACGiwhEBPCJYM4KoHx3hg8bfBmqEzX29%2BpWn6%3D1W3Sq2Sf0bZA%40mail.gmail.com.
--001a114be8fea75abb053981d131
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div><div><div>...sorry, I didn't read closely enough =
the first time. So you definitely mean simultaneously.<br><br></div>I'm=
not sure this fits the intended model of range-for, as it would really req=
uire all ranges to have identical numbers of elements, whereas the point of=
range-for is that you don't care about how many elements you have or w=
hich index you're currently at - you just want to do something for them=
all.<br><br></div>If the situation you want this for is e.g. copying from =
source to destination pointers, then I think that idiom is so well-establis=
hed that it wouldn't suffice as a justification for this, and if anythi=
ng, it might look more obfuscated with this sort of range-for.<br><br></div=
>But I might be wrong...<br><br></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CACGiwhEBPCJYM4KoHx3hg8bfBmqEzX29%2Bp=
Wn6%3D1W3Sq2Sf0bZA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CACGiwhEBPCJY=
M4KoHx3hg8bfBmqEzX29%2BpWn6%3D1W3Sq2Sf0bZA%40mail.gmail.com</a>.<br />
--001a114be8fea75abb053981d131--
.
Author: Daker Fernandes Pinheiro <dakerfp@gmail.com>
Date: Sun, 7 Aug 2016 18:26:24 -0300
Raw View
--94eb2c14c282d493be053981f418
Content-Type: text/plain; charset=UTF-8
It is a kind of python's:
for a, b in zip(iterA, iterB):
....
It stop iteration when the first iterator stop.
2016-08-07 18:16 GMT-03:00 D. B. <db0451@gmail.com>:
> ...sorry, I didn't read closely enough the first time. So you definitely
> mean simultaneously.
>
> I'm not sure this fits the intended model of range-for, as it would really
> require all ranges to have identical numbers of elements, whereas the point
> of range-for is that you don't care about how many elements you have or
> which index you're currently at - you just want to do something for them
> all.
>
> If the situation you want this for is e.g. copying from source to
> destination pointers, then I think that idiom is so well-established that
> it wouldn't suffice as a justification for this, and if anything, it might
> look more obfuscated with this sort of range-for.
>
> But I might be wrong...
>
> --
> 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/CACGiwhEBPCJYM4KoHx3hg8bfBmqEz
> X29%2BpWn6%3D1W3Sq2Sf0bZA%40mail.gmail.com
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CACGiwhEBPCJYM4KoHx3hg8bfBmqEzX29%2BpWn6%3D1W3Sq2Sf0bZA%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
--
Daker Fernandes Pinheiro
http://codecereal.blogspot.com
--
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/CAHhpqgZhDedJ4hVswqrK2y-oN9U2rD8exHUPQnzUhU1%2BS%3Dti8w%40mail.gmail.com.
--94eb2c14c282d493be053981f418
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">It is a kind of python's:<div><br><div>for a, b in zip=
(iterA, iterB):</div><div>=C2=A0 =C2=A0 ....</div><div><br></div><div>It st=
op iteration when the first iterator stop.</div><div><br></div></div></div>=
<div class=3D"gmail_extra"><br><div class=3D"gmail_quote">2016-08-07 18:16 =
GMT-03:00 D. B. <span dir=3D"ltr"><<a href=3D"mailto:db0451@gmail.com" t=
arget=3D"_blank">db0451@gmail.com</a>></span>:<br><blockquote class=3D"g=
mail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-l=
eft:1ex"><div dir=3D"ltr"><div><div><div>...sorry, I didn't read closel=
y enough the first time. So you definitely mean simultaneously.<br><br></di=
v>I'm not sure this fits the intended model of range-for, as it would r=
eally require all ranges to have identical numbers of elements, whereas the=
point of range-for is that you don't care about how many elements you =
have or which index you're currently at - you just want to do something=
for them all.<br><br></div>If the situation you want this for is e.g. copy=
ing from source to destination pointers, then I think that idiom is so well=
-established that it wouldn't suffice as a justification for this, and =
if anything, it might look more obfuscated with this sort of range-for.<br>=
<br></div>But I might be wrong...<br><br></div><span class=3D"">
<p></p>
-- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br></span>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CACGiwhEBPCJYM4KoHx3hg8bfBmqEzX29%2Bp=
Wn6%3D1W3Sq2Sf0bZA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoo=
ter" target=3D"_blank">https://groups.google.com/a/<wbr>isocpp.org/d/msgid/=
std-<wbr>proposals/<wbr>CACGiwhEBPCJYM4KoHx3hg8bfBmqEz<wbr>X29%2BpWn6%3D1W3=
Sq2Sf0bZA%<wbr>40mail.gmail.com</a>.<br>
</blockquote></div><br><br clear=3D"all"><div><br></div>-- <br><div class=
=3D"gmail_signature" data-smartmail=3D"gmail_signature">Daker Fernandes Pin=
heiro<br><a href=3D"http://codecereal.blogspot.com" target=3D"_blank">http:=
//codecereal.blogspot.com</a><br></div>
</div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CAHhpqgZhDedJ4hVswqrK2y-oN9U2rD8exHUP=
QnzUhU1%2BS%3Dti8w%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAHhpqgZhDedJ=
4hVswqrK2y-oN9U2rD8exHUPQnzUhU1%2BS%3Dti8w%40mail.gmail.com</a>.<br />
--94eb2c14c282d493be053981f418--
.
Author: "D. B." <db0451@gmail.com>
Date: Sun, 7 Aug 2016 22:34:00 +0100
Raw View
--001a114b3dacdbbd2a0539820e00
Content-Type: text/plain; charset=UTF-8
Cool, well if there's a pre-existing model that's widely used, then it
might be a lot more likely to succeed than I thought. :-) I haven't gotten
around to learning Python... yet.
--
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/CACGiwhFJycKis0_MYk%2BpHw12JQDUjMM1bA-B-DR2PUwy9KtYCw%40mail.gmail.com.
--001a114b3dacdbbd2a0539820e00
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Cool, well if there's a pre-existing model that's =
widely used, then it might be a lot more likely to succeed than I thought. =
:-) I haven't gotten around to learning Python... yet.<br></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CACGiwhFJycKis0_MYk%2BpHw12JQDUjMM1bA=
-B-DR2PUwy9KtYCw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CACGiwhFJycKis0=
_MYk%2BpHw12JQDUjMM1bA-B-DR2PUwy9KtYCw%40mail.gmail.com</a>.<br />
--001a114b3dacdbbd2a0539820e00--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Mon, 8 Aug 2016 00:34:59 +0300
Raw View
On 7 August 2016 at 23:49, Antonio Perez <antonio@perezexcelsior.com> wrote:
> Currently, the range-based for statement, defined in section 6.5.4 of the
> C++ international Standard, is defined as follows:
>
> The range-based for statement
> for ( for-range-declaration : for-range-initializer ) statement
> is equivalent to
> {
> auto &&__range = for-range-initializer ;
> auto __begin = begin-expr ;
> auto __end = end-expr ;
> for ( ; __begin != __end; ++__begin ) {
> for-range-declaration = *__begin;
> statement
> }
> }
>
> I propose that the range-based for statement is expanded to allow iteration
> through multiple for-range-initializes simultaneously, with
> for ( for-range-declaration : for-range-initializer; for-range-declaration2
> : for-range-initializer2 /*; ...*/) statement
This is https://cplusplus.github.io/EWG/ewg-active.html#43
and there's also
http://open-std.org/JTC1/SC22/WG21/docs/papers/2015/p0026r0.pdf
which was reviewed in Jacksonville but put on hold for now, pending
further investigations
on whether a library approach is in all aspects superior.
--
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/CAFk2RUZUMr%3DhStemS6gdyEc%3DDk-h6jnxZoqWGcuK43KYGF7DnA%40mail.gmail.com.
.
Author: Antonio Perez <antonio@perezexcelsior.com>
Date: Sun, 7 Aug 2016 14:42:27 -0700 (PDT)
Raw View
------=_Part_707_560872196.1470606147437
Content-Type: multipart/alternative;
boundary="----=_Part_708_1977571307.1470606147438"
------=_Part_708_1977571307.1470606147438
Content-Type: text/plain; charset=UTF-8
Yes! That is what I'm proposing. Example code you could write with this:
template<int n> array<double, n> add(array<double, n>& x1, array<double,
n>& x2) {
array<double, n> sum;
for (double& s : sum; double v1 : x1; double v2 : x2)
{
s = v1 + v2;
}
return sum;
}
template<int n> double dot(array<double, n>& x1, array<double, n> x2) {
double sum = 0.0;
for (double v1 : x1; double v2 : x2)
{
sum += v1 * v2;
}
return sum;
}
template<int rows, int cols> array<double, rows> mul(const
array<array<double, cols>, rows>& matrix, const array<double, cols>&
vector) {
array<double, rows> result;
for (const auto& row : matrix; double& sum : result)
{
sum = 0;
for (double& x1 : row; double& x2 : vector)
{
sum += x1 * x2;
}
}
return result;
}
On Sunday, August 7, 2016 at 3:35:01 PM UTC-6, Ville Voutilainen wrote:
>
> On 7 August 2016 at 23:49, Antonio Perez <ant...@perezexcelsior.com
> <javascript:>> wrote:
> > Currently, the range-based for statement, defined in section 6.5.4 of
> the
> > C++ international Standard, is defined as follows:
> >
> > The range-based for statement
> > for ( for-range-declaration : for-range-initializer ) statement
> > is equivalent to
> > {
> > auto &&__range = for-range-initializer ;
> > auto __begin = begin-expr ;
> > auto __end = end-expr ;
> > for ( ; __begin != __end; ++__begin ) {
> > for-range-declaration = *__begin;
> > statement
> > }
> > }
> >
> > I propose that the range-based for statement is expanded to allow
> iteration
> > through multiple for-range-initializes simultaneously, with
> > for ( for-range-declaration : for-range-initializer;
> for-range-declaration2
> > : for-range-initializer2 /*; ...*/) statement
>
>
> This is https://cplusplus.github.io/EWG/ewg-active.html#43
> and there's also
> http://open-std.org/JTC1/SC22/WG21/docs/papers/2015/p0026r0.pdf
> which was reviewed in Jacksonville but put on hold for now, pending
> further investigations
> on whether a library approach is in all aspects superior.
>
--
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/e76a67ac-96c6-493e-8d67-80450bb71e70%40isocpp.org.
------=_Part_708_1977571307.1470606147438
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Yes! That is what I'm proposing. Example code you coul=
d write with this:<div><br></div><div><div class=3D"prettyprint" style=3D"b=
order: 1px solid rgb(187, 187, 187); word-wrap: break-word; background-colo=
r: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subpretty=
print"><div class=3D"subprettyprint">template<int n> array<double,=
n> add(array<double, n>& x1, array<double, n>& x2) =
{</div><div class=3D"subprettyprint"><span class=3D"Apple-tab-span" style=
=3D"white-space:pre"> </span>array<double, n> sum;</div><div class=3D=
"subprettyprint"><span class=3D"Apple-tab-span" style=3D"white-space:pre"> =
</span>for (double& s : sum; double v1 : x1; double v2 : x2)</div><div =
class=3D"subprettyprint"><span class=3D"Apple-tab-span" style=3D"white-spac=
e:pre"> </span>{</div><div class=3D"subprettyprint"><span class=3D"Apple-ta=
b-span" style=3D"white-space:pre"> </span>s =3D v1 + v2;</div><div class=
=3D"subprettyprint"><span class=3D"Apple-tab-span" style=3D"white-space:pre=
"> </span>}</div><div class=3D"subprettyprint"><span class=3D"Apple-tab-spa=
n" style=3D"white-space:pre"> </span>return sum;</div><div class=3D"subpret=
typrint">}</div><div class=3D"subprettyprint">template<int n> double =
dot(array<double, n>& x1, array<double, n> x2) {</div><div =
class=3D"subprettyprint"><span class=3D"Apple-tab-span" style=3D"white-spac=
e:pre"> </span>double sum =3D 0.0;</div><div class=3D"subprettyprint"><span=
class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>for (double v1 =
: x1; double v2 : x2)</div><div class=3D"subprettyprint"><span class=3D"App=
le-tab-span" style=3D"white-space:pre"> </span>{</div><div class=3D"subpret=
typrint"><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>=
sum +=3D v1 * v2;</div><div class=3D"subprettyprint"><span class=3D"Apple-t=
ab-span" style=3D"white-space:pre"> </span>}</div><div class=3D"subprettypr=
int"><span class=3D"Apple-tab-span" style=3D"white-space:pre"> </span>retur=
n sum;</div><div class=3D"subprettyprint">}</div><div class=3D"subprettypri=
nt">template<int rows, int cols> array<double, rows> mul(const =
array<array<double, cols>, rows>& matrix, const array<do=
uble, cols>& vector) {</div><div class=3D"subprettyprint"><span clas=
s=3D"Apple-tab-span" style=3D"white-space:pre"> </span>array<double, row=
s> result;</div><div class=3D"subprettyprint"><span class=3D"Apple-tab-s=
pan" style=3D"white-space:pre"> </span>for (const auto& row : matrix; d=
ouble& sum : result)=C2=A0</div><div class=3D"subprettyprint"><span cla=
ss=3D"Apple-tab-span" style=3D"white-space:pre"> </span>{</div><div class=
=3D"subprettyprint"><span class=3D"Apple-tab-span" style=3D"white-space:pre=
"> </span>sum =3D 0;</div><div class=3D"subprettyprint"><span class=3D"App=
le-tab-span" style=3D"white-space:pre"> </span>for (double& x1 : row; =
double& x2 : vector)=C2=A0</div><div class=3D"subprettyprint"><span cla=
ss=3D"Apple-tab-span" style=3D"white-space:pre"> </span>{</div><div class=
=3D"subprettyprint"><span class=3D"Apple-tab-span" style=3D"white-space:pre=
"> </span>sum +=3D x1 * x2;</div><div class=3D"subprettyprint"><span clas=
s=3D"Apple-tab-span" style=3D"white-space:pre"> </span>}</div><div class=
=3D"subprettyprint"><span class=3D"Apple-tab-span" style=3D"white-space:pre=
"> </span>}</div><div class=3D"subprettyprint"><span class=3D"Apple-tab-spa=
n" style=3D"white-space:pre"> </span>return result;</div><div class=3D"subp=
rettyprint">}</div></div></code></div><br><br><br>On Sunday, August 7, 2016=
at 3:35:01 PM UTC-6, Ville Voutilainen wrote:<blockquote class=3D"gmail_qu=
ote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padd=
ing-left: 1ex;">On 7 August 2016 at 23:49, Antonio Perez <<a href=3D"jav=
ascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"wPCMxH2bCAAJ" rel=3D"n=
ofollow" onmousedown=3D"this.href=3D'javascript:';return true;" onc=
lick=3D"this.href=3D'javascript:';return true;">ant...@perezexcelsi=
or.com</a>> wrote:
<br>> Currently, the range-based for statement, defined in section 6.5.4=
of the
<br>> C++ international Standard, is defined as follows:
<br>>
<br>> =C2=A0The range-based for statement
<br>> for ( for-range-declaration : for-range-initializer ) statement
<br>> is equivalent to
<br>> {
<br>> =C2=A0 =C2=A0 auto &&__range =3D for-range-initializer ;
<br>> =C2=A0 =C2=A0 auto __begin =3D begin-expr ;
<br>> =C2=A0 =C2=A0 auto __end =3D end-expr ;
<br>> =C2=A0 =C2=A0 for ( ; __begin !=3D __end; ++__begin ) {
<br>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 for-range-declaration =3D *__begin;
<br>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 statement
<br>> =C2=A0 =C2=A0 }
<br>> }
<br>>
<br>> I propose that the range-based for statement is expanded to allow =
iteration
<br>> through multiple for-range-initializes simultaneously, with
<br>> for ( for-range-declaration : for-range-initializer; for-range-dec=
laration2
<br>> : for-range-initializer2 /*; ...*/) statement
<br>
<br>
<br>This is <a href=3D"https://cplusplus.github.io/EWG/ewg-active.html#43" =
target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'https://=
www.google.com/url?q\x3dhttps%3A%2F%2Fcplusplus.github.io%2FEWG%2Fewg-activ=
e.html%2343\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEaWNqLXSG7NXFeDqv7HOLVI=
_y_CA';return true;" onclick=3D"this.href=3D'https://www.google.com=
/url?q\x3dhttps%3A%2F%2Fcplusplus.github.io%2FEWG%2Fewg-active.html%2343\x2=
6sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEaWNqLXSG7NXFeDqv7HOLVI_y_CA';ret=
urn true;">https://cplusplus.github.io/<wbr>EWG/ewg-active.html#43</a>
<br>and there's also
<br><a href=3D"http://open-std.org/JTC1/SC22/WG21/docs/papers/2015/p0026r0.=
pdf" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'htt=
p://www.google.com/url?q\x3dhttp%3A%2F%2Fopen-std.org%2FJTC1%2FSC22%2FWG21%=
2Fdocs%2Fpapers%2F2015%2Fp0026r0.pdf\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQj=
CNFnJgG2aOPIgMsqoh9fGCJoZCZb7w';return true;" onclick=3D"this.href=3D&#=
39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fopen-std.org%2FJTC1%2FSC22%2=
FWG21%2Fdocs%2Fpapers%2F2015%2Fp0026r0.pdf\x26sa\x3dD\x26sntz\x3d1\x26usg\x=
3dAFQjCNFnJgG2aOPIgMsqoh9fGCJoZCZb7w';return true;">http://open-std.org=
/JTC1/SC22/<wbr>WG21/docs/papers/2015/p0026r0.<wbr>pdf</a>
<br>which was reviewed in Jacksonville but put on hold for now, pending
<br>further investigations
<br>on whether a library approach is in all aspects superior.
<br></blockquote></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/e76a67ac-96c6-493e-8d67-80450bb71e70%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/e76a67ac-96c6-493e-8d67-80450bb71e70=
%40isocpp.org</a>.<br />
------=_Part_708_1977571307.1470606147438--
------=_Part_707_560872196.1470606147437--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Sun, 7 Aug 2016 14:57:24 -0700 (PDT)
Raw View
------=_Part_662_1608011318.1470607044971
Content-Type: multipart/alternative;
boundary="----=_Part_663_1411379459.1470607044972"
------=_Part_663_1411379459.1470607044972
Content-Type: text/plain; charset=UTF-8
On Sunday, August 7, 2016 at 5:35:01 PM UTC-4, Ville Voutilainen wrote:
>
> On 7 August 2016 at 23:49, Antonio Perez <ant...@perezexcelsior.com
> <javascript:>> wrote:
> > Currently, the range-based for statement, defined in section 6.5.4 of
> the
> > C++ international Standard, is defined as follows:
> >
> > The range-based for statement
> > for ( for-range-declaration : for-range-initializer ) statement
> > is equivalent to
> > {
> > auto &&__range = for-range-initializer ;
> > auto __begin = begin-expr ;
> > auto __end = end-expr ;
> > for ( ; __begin != __end; ++__begin ) {
> > for-range-declaration = *__begin;
> > statement
> > }
> > }
> >
> > I propose that the range-based for statement is expanded to allow
> iteration
> > through multiple for-range-initializes simultaneously, with
> > for ( for-range-declaration : for-range-initializer;
> for-range-declaration2
> > : for-range-initializer2 /*; ...*/) statement
>
>
> This is https://cplusplus.github.io/EWG/ewg-active.html#43
> and there's also
> http://open-std.org/JTC1/SC22/WG21/docs/papers/2015/p0026r0.pdf
> which was reviewed in Jacksonville but put on hold for now, pending
> further investigations
> on whether a library approach is in all aspects superior.
>
With structured binding, it'd be somewhat difficult to justify why a
`std::zip`-style solution would be incapable of being equally as effective
as a language one. Indeed, I'd much rather see this:
for(auto &[x, y] : std::zip(rng1, rng2))
Than this:
for(auto &x : rng1 ; auto &y : rng2)
--
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/2e8d0c8d-2406-4e89-b763-de1ba94e2248%40isocpp.org.
------=_Part_663_1411379459.1470607044972
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Sunday, August 7, 2016 at 5:35:01 PM UTC-4, Ville Vouti=
lainen wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-le=
ft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On 7 August 2016 =
at 23:49, Antonio Perez <<a href=3D"javascript:" target=3D"_blank" gdf-o=
bfuscated-mailto=3D"wPCMxH2bCAAJ" rel=3D"nofollow" onmousedown=3D"this.href=
=3D'javascript:';return true;" onclick=3D"this.href=3D'javascri=
pt:';return true;">ant...@perezexcelsior.com</a>> wrote:
<br>> Currently, the range-based for statement, defined in section 6.5.4=
of the
<br>> C++ international Standard, is defined as follows:
<br>>
<br>> =C2=A0The range-based for statement
<br>> for ( for-range-declaration : for-range-initializer ) statement
<br>> is equivalent to
<br>> {
<br>> =C2=A0 =C2=A0 auto &&__range =3D for-range-initializer ;
<br>> =C2=A0 =C2=A0 auto __begin =3D begin-expr ;
<br>> =C2=A0 =C2=A0 auto __end =3D end-expr ;
<br>> =C2=A0 =C2=A0 for ( ; __begin !=3D __end; ++__begin ) {
<br>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 for-range-declaration =3D *__begin;
<br>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 statement
<br>> =C2=A0 =C2=A0 }
<br>> }
<br>>
<br>> I propose that the range-based for statement is expanded to allow =
iteration
<br>> through multiple for-range-initializes simultaneously, with
<br>> for ( for-range-declaration : for-range-initializer; for-range-dec=
laration2
<br>> : for-range-initializer2 /*; ...*/) statement
<br>
<br>
<br>This is <a href=3D"https://cplusplus.github.io/EWG/ewg-active.html#43" =
target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'https://=
www.google.com/url?q\x3dhttps%3A%2F%2Fcplusplus.github.io%2FEWG%2Fewg-activ=
e.html%2343\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEaWNqLXSG7NXFeDqv7HOLVI=
_y_CA';return true;" onclick=3D"this.href=3D'https://www.google.com=
/url?q\x3dhttps%3A%2F%2Fcplusplus.github.io%2FEWG%2Fewg-active.html%2343\x2=
6sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEaWNqLXSG7NXFeDqv7HOLVI_y_CA';ret=
urn true;">https://cplusplus.github.io/<wbr>EWG/ewg-active.html#43</a>
<br>and there's also
<br><a href=3D"http://open-std.org/JTC1/SC22/WG21/docs/papers/2015/p0026r0.=
pdf" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'htt=
p://www.google.com/url?q\x3dhttp%3A%2F%2Fopen-std.org%2FJTC1%2FSC22%2FWG21%=
2Fdocs%2Fpapers%2F2015%2Fp0026r0.pdf\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQj=
CNFnJgG2aOPIgMsqoh9fGCJoZCZb7w';return true;" onclick=3D"this.href=3D&#=
39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fopen-std.org%2FJTC1%2FSC22%2=
FWG21%2Fdocs%2Fpapers%2F2015%2Fp0026r0.pdf\x26sa\x3dD\x26sntz\x3d1\x26usg\x=
3dAFQjCNFnJgG2aOPIgMsqoh9fGCJoZCZb7w';return true;">http://open-std.org=
/JTC1/SC22/<wbr>WG21/docs/papers/2015/p0026r0.<wbr>pdf</a>
<br>which was reviewed in Jacksonville but put on hold for now, pending
<br>further investigations
<br>on whether a library approach is in all aspects superior.
<br></blockquote><div><br>With structured binding, it'd be somewhat dif=
ficult to justify why a `std::zip`-style solution would be incapable of bei=
ng equally as effective as a language one. Indeed, I'd much rather see =
this:<br><br><div class=3D"prettyprint" style=3D"background-color: rgb(250,=
250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-w=
idth: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div class=
=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">for</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&[</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify">x</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> y</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">]</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">:=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify">zip</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify">rng1</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> rng2</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">))</span></div></code></div><br>Than this:<br><br><div class=
=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); border-colo=
r: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: b=
reak-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span=
style=3D"color: #008;" class=3D"styled-by-prettify">for</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">auto</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">x </span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">:</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> rng1 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">;<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">auto</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">&</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify">y </span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">:</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> rng2</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">)</span></div></code></div><br><br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/2e8d0c8d-2406-4e89-b763-de1ba94e2248%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/2e8d0c8d-2406-4e89-b763-de1ba94e2248=
%40isocpp.org</a>.<br />
------=_Part_663_1411379459.1470607044972--
------=_Part_662_1608011318.1470607044971--
.
Author: Izzy Coding <matthew.i.greenwood@gmail.com>
Date: Sun, 7 Aug 2016 22:14:04 -0700 (PDT)
Raw View
------=_Part_3796_883869693.1470633245038
Content-Type: text/plain; charset=UTF-8
It was my understanding tha P0026 was refused due to another proposal allowing the mapping of parts within the initializer.
E.g.
for (auto [a, b]: {list1, list2}) { ... }
Personally I don't like the idea of this. Feels dirty to me that we need to combine the different entities together just so we can iterate them at the same time. It almost seems like mixing concerns.
Also could a for loop as described in P0026 not be use to implement the zip method internals? It would be interesting to see how that is implemented compared with this proposal.
--
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/2e33b856-a7de-4e65-b8e3-f0da020022d5%40isocpp.org.
------=_Part_3796_883869693.1470633245038--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Mon, 8 Aug 2016 08:29:43 -0700 (PDT)
Raw View
------=_Part_4124_1505177958.1470670183344
Content-Type: multipart/alternative;
boundary="----=_Part_4125_632544526.1470670183344"
------=_Part_4125_632544526.1470670183344
Content-Type: text/plain; charset=UTF-8
On Monday, August 8, 2016 at 1:14:05 AM UTC-4, Izzy Coding wrote:
>
> It was my understanding tha P0026 was refused due to another proposal
> allowing the mapping of parts within the initializer.
>
> E.g.
> for (auto [a, b]: {list1, list2}) { ... }
>
> Personally I don't like the idea of this. Feels dirty to me that we need
> to combine the different entities together just so we can iterate them at
> the same time. It almost seems like mixing concerns.
>
But you *are* mixing concerns. You're iterating through multiple ranges
simultaneously. The loop will end when *one* of the ranges ends. The
behavior of the loop is based on the aggregation of the ranges.
So actually *aggregating* them seems entirely appropriate.
With a single range-for, you have "Variable : Range". With multi-range-for,
you have "Variables : Ranges". Having it be "Variable: Range; Variable:
Range" feels really strange. Especially since we have structured binding
and thus have a way to declare "Variables".
So even as a language feature, I'd much rather have what you showed above
(though the braced-init-list is potentially problematic) than the
semicolon-based syntax.
> Also could a for loop as described in P0026 not be use to implement the
> zip method internals?
>
How could a multi-range `for` be used to implement a zip iterator/range?
--
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/857a5c43-bd74-4c86-88e8-791f5e8df231%40isocpp.org.
------=_Part_4125_632544526.1470670183344
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Monday, August 8, 2016 at 1:14:05 AM UTC-4, Izzy Coding=
wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.=
8ex;border-left: 1px #ccc solid;padding-left: 1ex;">It was my understanding=
tha P0026 was refused due to another proposal allowing the mapping of part=
s within the initializer.<p>E.g.<br>for (auto [a, b]: {list1, list2}) { ...=
}</p><p>Personally I don't like the idea of this. Feels dirty to me th=
at we need to combine the different entities together just so we can iterat=
e them at the same time. It almost seems like mixing concerns.</p></blockqu=
ote><div><br>But you <i>are</i> mixing concerns. You're iterating throu=
gh multiple ranges simultaneously. The loop will end when <i>one</i> of the=
ranges ends. The behavior of the loop is based on the aggregation of the r=
anges.<br><br>So actually <i>aggregating</i> them seems entirely appropriat=
e.<br><br>With a single range-for, you have "Variable : Range". W=
ith multi-range-for, you have "Variables : Ranges". Having it be =
"Variable: Range; Variable: Range" feels really strange. Especial=
ly since we have structured binding and thus have a way to declare "Va=
riables".<br><br>So even as a language feature, I'd much rather ha=
ve what you showed above (though the braced-init-list is potentially proble=
matic) than the semicolon-based syntax.<br>=C2=A0</div><blockquote class=3D=
"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc s=
olid;padding-left: 1ex;"><p>Also could a for loop as described in P0026 not=
be use to implement the zip method internals?</p></blockquote><div><br>How=
could a multi-range `for` be used to implement a zip iterator/range?<br></=
div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/857a5c43-bd74-4c86-88e8-791f5e8df231%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/857a5c43-bd74-4c86-88e8-791f5e8df231=
%40isocpp.org</a>.<br />
------=_Part_4125_632544526.1470670183344--
------=_Part_4124_1505177958.1470670183344--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Mon, 8 Aug 2016 18:41:30 +0300
Raw View
On 8 August 2016 at 18:29, Nicol Bolas <jmckesson@gmail.com> wrote:
> On Monday, August 8, 2016 at 1:14:05 AM UTC-4, Izzy Coding wrote:
>>
>> It was my understanding tha P0026 was refused due to another proposal
>> allowing the mapping of parts within the initializer.
>>
>> E.g.
>> for (auto [a, b]: {list1, list2}) { ... }
>>
>> Personally I don't like the idea of this. Feels dirty to me that we need
>> to combine the different entities together just so we can iterate them at
>> the same time. It almost seems like mixing concerns.
>
>
> But you are mixing concerns. You're iterating through multiple ranges
> simultaneously. The loop will end when one of the ranges ends. The behavior
> of the loop is based on the aggregation of the ranges.
>
> So actually aggregating them seems entirely appropriate.
Da huh? The code above looks like it creates an initializer_list of
list1 and list2, and
then tries to create a and b as decompositions of each element of that
initializer_list.
That certainly doesn't do what the multi-iteration range-for proposal
tried to do.
> With a single range-for, you have "Variable : Range". With multi-range-for,
> you have "Variables : Ranges". Having it be "Variable: Range; Variable:
The loop above is not a "multi-range-for", it's using destructured bindings with
an initializer_list.
--
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/CAFk2RUZ4gxmL6xDjh1af_vNKCvZYcYhdfKUsNp%2BW3L6s4WbQNg%40mail.gmail.com.
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Mon, 8 Aug 2016 09:13:32 -0700 (PDT)
Raw View
------=_Part_4514_310811846.1470672812137
Content-Type: multipart/alternative;
boundary="----=_Part_4515_2006619090.1470672812138"
------=_Part_4515_2006619090.1470672812138
Content-Type: text/plain; charset=UTF-8
On Monday, August 8, 2016 at 11:41:33 AM UTC-4, Ville Voutilainen wrote:
>
> On 8 August 2016 at 18:29, Nicol Bolas <jmck...@gmail.com <javascript:>>
> wrote:
> > On Monday, August 8, 2016 at 1:14:05 AM UTC-4, Izzy Coding wrote:
> >>
> >> It was my understanding tha P0026 was refused due to another proposal
> >> allowing the mapping of parts within the initializer.
> >>
> >> E.g.
> >> for (auto [a, b]: {list1, list2}) { ... }
> >>
> >> Personally I don't like the idea of this. Feels dirty to me that we
> need
> >> to combine the different entities together just so we can iterate them
> at
> >> the same time. It almost seems like mixing concerns.
> >
> >
> > But you are mixing concerns. You're iterating through multiple ranges
> > simultaneously. The loop will end when one of the ranges ends. The
> behavior
> > of the loop is based on the aggregation of the ranges.
> >
> > So actually aggregating them seems entirely appropriate.
>
> Da huh? The code above looks like it creates an initializer_list of
> list1 and list2, and
> then tries to create a and b as decompositions of each element of that
> initializer_list.
> That certainly doesn't do what the multi-iteration range-for proposal
> tried to do.
>
I wasn't specifically speaking to that example. It was about the general
"Variables : Ranges" style vs. "Variable : Range ; Variable : Range" style.
How you achieve one vs. the other isn't really the point.
--
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/93e57a07-ec70-4846-b8f4-7d25d47a9190%40isocpp.org.
------=_Part_4515_2006619090.1470672812138
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Monday, August 8, 2016 at 11:41:33 AM UTC-4, Vi=
lle Voutilainen wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;=
margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On 8 Aug=
ust 2016 at 18:29, Nicol Bolas <<a href=3D"javascript:" target=3D"_blank=
" gdf-obfuscated-mailto=3D"e-hOZsjWCAAJ" rel=3D"nofollow" onmousedown=3D"th=
is.href=3D'javascript:';return true;" onclick=3D"this.href=3D'j=
avascript:';return true;">jmck...@gmail.com</a>> wrote:
<br>> On Monday, August 8, 2016 at 1:14:05 AM UTC-4, Izzy Coding wrote:
<br>>>
<br>>> It was my understanding tha P0026 was refused due to another p=
roposal
<br>>> allowing the mapping of parts within the initializer.
<br>>>
<br>>> E.g.
<br>>> for (auto [a, b]: {list1, list2}) { ... }
<br>>>
<br>>> Personally I don't like the idea of this. Feels dirty to m=
e that we need
<br>>> to combine the different entities together just so we can iter=
ate them at
<br>>> the same time. It almost seems like mixing concerns.
<br>>
<br>>
<br>> But you are mixing concerns. You're iterating through multiple=
ranges
<br>> simultaneously. The loop will end when one of the ranges ends. The=
behavior
<br>> of the loop is based on the aggregation of the ranges.
<br>>
<br>> So actually aggregating them seems entirely appropriate.
<br>
<br>Da huh? The code above looks like it creates an initializer_list of
<br>list1 and list2, and
<br>then tries to create a and b as decompositions of each element of that
<br>initializer_list.
<br>That certainly doesn't do what the multi-iteration range-for propos=
al
<br>tried to do.
<br></blockquote><div><br>I wasn't specifically speaking to that exampl=
e. It was about the general "Variables : Ranges" style vs. "=
Variable : Range ; Variable : Range" style. How you achieve one vs. th=
e other isn't really the point.</div><br></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/93e57a07-ec70-4846-b8f4-7d25d47a9190%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/93e57a07-ec70-4846-b8f4-7d25d47a9190=
%40isocpp.org</a>.<br />
------=_Part_4515_2006619090.1470672812138--
------=_Part_4514_310811846.1470672812137--
.
Author: Matthew Woehlke <mwoehlke.floss@gmail.com>
Date: Mon, 8 Aug 2016 16:09:39 -0400
Raw View
On 2016-08-07 16:49, Antonio Perez wrote:
> I propose that the range-based for statement is expanded to allow iteration
> through multiple for-range-initializes simultaneously [...]
Some general observations along the lines of the other replies...
A std::zip needn't be too expensive. It doesn't need to fully construct
a return object, and in fact probably *shouldn't*. At worst you have a
little bit of local state.
Another reason to go with something like std::zip is that you can
combine it with other iterator adaptors to iterate over the longest list
with 'filler' elements when the shorter runs out. Example:
for(auto&& [x, y] : std::zip(long_list, std::pad(short_list, 0)))
(...where std::pad is a hypothetical function that returns elements of
the input list until it runs out, then returns the filler element forever.)
--
Matthew
--
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/57A8E703.5070402%40gmail.com.
.
Author: Thiago Macieira <thiago@macieira.org>
Date: Mon, 08 Aug 2016 13:37:55 -0700
Raw View
On segunda-feira, 8 de agosto de 2016 16:09:39 PDT Matthew Woehlke wrote:
> for(auto&& [x, y] : std::zip(long_list, std::pad(short_list, 0)))
>
> (...where std::pad is a hypothetical function that returns elements of
> the input list until it runs out, then returns the filler element forever.)
This is an infinite loop:
for (auto x : std::pad(short_list, 0))
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
--
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/1893428.758yQJhokF%40tjmaciei-mobl1.
.
Author: Matthew Woehlke <mwoehlke.floss@gmail.com>
Date: Mon, 8 Aug 2016 16:50:38 -0400
Raw View
On 2016-08-08 16:37, Thiago Macieira wrote:
> On segunda-feira, 8 de agosto de 2016 16:09:39 PDT Matthew Woehlke wrote:
>> for(auto&& [x, y] : std::zip(long_list, std::pad(short_list, 0)))
>>
>> (...where std::pad is a hypothetical function that returns elements of
>> the input list until it runs out, then returns the filler element forever.)
>
> This is an infinite loop:
>
> for (auto x : std::pad(short_list, 0))
....yes? That's what "returns the filler element forever" implies...
--
Matthew
--
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/57A8F09E.5010001%40gmail.com.
.
Author: Sean Middleditch <sean.middleditch@gmail.com>
Date: Mon, 8 Aug 2016 16:29:46 -0700 (PDT)
Raw View
------=_Part_1603_376776878.1470698987080
Content-Type: multipart/alternative;
boundary="----=_Part_1604_1889790072.1470698987087"
------=_Part_1604_1889790072.1470698987087
Content-Type: text/plain; charset=UTF-8
On Monday, August 8, 2016 at 1:37:58 PM UTC-7, Thiago Macieira wrote:
>
> On segunda-feira, 8 de agosto de 2016 16:09:39 PDT Matthew Woehlke wrote:
> > for(auto&& [x, y] : std::zip(long_list, std::pad(short_list, 0)))
> >
> > (...where std::pad is a hypothetical function that returns elements of
> > the input list until it runs out, then returns the filler element
> forever.)
>
> This is an infinite loop:
>
> for (auto x : std::pad(short_list, 0))
>
Note that the ranges proposal generalizes and clearly defines infinite
ranges which are of course iterable in for-range. This isn't (won't be) a
new problem.
--
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Software Architect - Intel Open Source Technology Center
>
>
--
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/ccbbb4f5-2fbb-4c2a-86af-cc35af0ab75b%40isocpp.org.
------=_Part_1604_1889790072.1470698987087
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Monday, August 8, 2016 at 1:37:58 PM UTC-7, Thiago Maci=
eira wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left=
: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On segunda-feira, 8=
de agosto de 2016 16:09:39 PDT Matthew Woehlke wrote:
<br>> =C2=A0 for(auto&& [x, y] : std::zip(long_list, std::pad(sh=
ort_list, 0)))
<br>>=20
<br>> (...where std::pad is a hypothetical function that returns element=
s of
<br>> the input list until it runs out, then returns the filler element =
forever.)
<br>
<br>This is an infinite loop:
<br>
<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0for (auto x : std::pad(=
short_list, 0))
<br></blockquote><div><br></div><div>Note that the ranges proposal generali=
zes and clearly defines infinite ranges which are of course iterable in for=
-range. This isn't (won't be) a new problem.</div><div><br></div><b=
lockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;borde=
r-left: 1px #ccc solid;padding-left: 1ex;">--=20
<br>Thiago Macieira - thiago (AT) <a href=3D"http://macieira.info" target=
=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'http://www.goo=
gle.com/url?q\x3dhttp%3A%2F%2Fmacieira.info\x26sa\x3dD\x26sntz\x3d1\x26usg\=
x3dAFQjCNEswDUBNCNanbu7euhqLn_62FW8ag';return true;" onclick=3D"this.hr=
ef=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2Fmacieira.info\x26sa\x=
3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEswDUBNCNanbu7euhqLn_62FW8ag';return t=
rue;">macieira.info</a> - thiago (AT) <a href=3D"http://kde.org" target=3D"=
_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'http://www.google.=
com/url?q\x3dhttp%3A%2F%2Fkde.org\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH=
GRJdo5_JYG1DowztwAHAKs80XSA';return true;" onclick=3D"this.href=3D'=
http://www.google.com/url?q\x3dhttp%3A%2F%2Fkde.org\x26sa\x3dD\x26sntz\x3d1=
\x26usg\x3dAFQjCNHGRJdo5_JYG1DowztwAHAKs80XSA';return true;">kde.org</a=
>
<br>=C2=A0 =C2=A0Software Architect - Intel Open Source Technology Center
<br>
<br></blockquote></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/ccbbb4f5-2fbb-4c2a-86af-cc35af0ab75b%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/ccbbb4f5-2fbb-4c2a-86af-cc35af0ab75b=
%40isocpp.org</a>.<br />
------=_Part_1604_1889790072.1470698987087--
------=_Part_1603_376776878.1470698987080--
.
Author: Arthur O'Dwyer <arthur.j.odwyer@gmail.com>
Date: Mon, 8 Aug 2016 18:01:22 -0700 (PDT)
Raw View
------=_Part_12_1514683338.1470704482933
Content-Type: multipart/alternative;
boundary="----=_Part_13_1857428758.1470704482934"
------=_Part_13_1857428758.1470704482934
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Monday, August 8, 2016 at 4:29:47 PM UTC-7, Sean Middleditch wrote:
>
> On Monday, August 8, 2016 at 1:37:58 PM UTC-7, Thiago Macieira wrote:
>>
>> On segunda-feira, 8 de agosto de 2016 16:09:39 PDT Matthew Woehlke wrote=
:=20
>> > for(auto&& [x, y] : std::zip(long_list, std::pad(short_list, 0)))=20
>> >=20
>> > (...where std::pad is a hypothetical function that returns elements of=
=20
>> > the input list until it runs out, then returns the filler element=20
>> forever.)=20
>>
>> This is an infinite loop:=20
>>
>> for (auto x : std::pad(short_list, 0))=20
>>
>
> Note that the ranges proposal generalizes and clearly defines infinite=20
> ranges which are of course iterable in for-range. This isn't (won't be) a=
=20
> new problem.
>
[I'm not contradicting anything you said, just expanding on it:]
This already isn't a new problem; it's easy to create objects X in C++11=20
such that
for (auto&& x : X) { }
is an infinite loop, just as it was possible in C++03 to create objects X=
=20
such that
for (X_t::iterator it =3D X.begin(); it !=3D X.end(); ++it) { }
was an infinite loop. (Yeesh, it pained me to write that code just now!=20
Hooray for decltype and auto.) The Ranges proposal does seem to inject the=
=20
concept very neatly into its philosophical model, but infinite and/or=20
sentineled ranges have been *around* since forever =E2=80=94 just not neces=
sarily=20
in a nice neat guise.
It looks like in Eric Niebler's Ranges-v3, Matthew's hypothetical std::pad=
(r,=20
v) is spelled ranges::view::concat(r, ranges::view::repeat(v)) .
=E2=80=93Arthur
--=20
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 e=
mail 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/ba43c8fe-2374-4ce9-9ae9-abc7a60cc0bb%40isocpp.or=
g.
------=_Part_13_1857428758.1470704482934
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Monday, August 8, 2016 at 4:29:47 PM UTC-7, Sean Middle=
ditch wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-lef=
t: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">O=
n Monday, August 8, 2016 at 1:37:58 PM UTC-7, Thiago Macieira wrote:<blockq=
uote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:=
1px #ccc solid;padding-left:1ex">On segunda-feira, 8 de agosto de 2016 16:0=
9:39 PDT Matthew Woehlke wrote:
<br>> =C2=A0 for(auto&& [x, y] : std::zip(long_list, std::pad(sh=
ort_list, 0)))
<br>>=20
<br>> (...where std::pad is a hypothetical function that returns element=
s of
<br>> the input list until it runs out, then returns the filler element =
forever.)
<br>
<br>This is an infinite loop:
<br>
<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0for (auto x : std::pad(=
short_list, 0))
<br></blockquote><div><br></div><div>Note that the ranges proposal generali=
zes and clearly defines infinite ranges which are of course iterable in for=
-range. This isn't (won't be) a new problem.</div></div></blockquot=
e><div><br></div><div>[I'm not contradicting anything you said, just ex=
panding on it:]</div><div><br></div><div>This already isn't a new probl=
em; it's easy to create objects X in C++11 such that</div><div><br></di=
v><div>=C2=A0 =C2=A0 for (auto&& x : X) { }</div><div><br></div><di=
v>is an infinite loop, just as it was possible in C++03 to create objects X=
such that</div><div><br></div><div>=C2=A0 =C2=A0 for (X_t::iterator it =3D=
X.begin(); it !=3D X.end(); ++it) { }</div><div><br></div><div>was an infi=
nite loop. (Yeesh, it pained me to write that code just now! Hooray for dec=
ltype and auto.) =C2=A0The Ranges proposal does seem to inject the concept =
very neatly into its philosophical model, but infinite and/or sentineled ra=
nges have been <i>around</i> since forever =E2=80=94 just not necessarily i=
n a nice neat guise.</div><div><br></div><div>It looks like in Eric Niebler=
's Ranges-v3, Matthew's hypothetical =C2=A0<font face=3D"courier ne=
w, monospace">std::pad(r, v)</font> =C2=A0is spelled =C2=A0<font face=3D"co=
urier new, monospace">ranges::view::concat(r, ranges::view::repeat(v))</fon=
t> .</div><div><br></div><div>=E2=80=93Arthur</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/ba43c8fe-2374-4ce9-9ae9-abc7a60cc0bb%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/ba43c8fe-2374-4ce9-9ae9-abc7a60cc0bb=
%40isocpp.org</a>.<br />
------=_Part_13_1857428758.1470704482934--
------=_Part_12_1514683338.1470704482933--
.
Author: =?UTF-8?Q?Klaim_=2D_Jo=C3=ABl_Lamotte?= <mjklaim@gmail.com>
Date: Wed, 10 Aug 2016 00:28:53 +0200
Raw View
--001a11423eead3b2c80539ab0e78
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On 7 August 2016 at 23:34, Ville Voutilainen <ville.voutilainen@gmail.com>
wrote:
> On 7 August 2016 at 23:49, Antonio Perez <antonio@perezexcelsior.com>
> wrote:
> > Currently, the range-based for statement, defined in section 6.5.4 of t=
he
> > C++ international Standard, is defined as follows:
> >
> > The range-based for statement
> > for ( for-range-declaration : for-range-initializer ) statement
> > is equivalent to
> > {
> > auto &&__range =3D for-range-initializer ;
> > auto __begin =3D begin-expr ;
> > auto __end =3D end-expr ;
> > for ( ; __begin !=3D __end; ++__begin ) {
> > for-range-declaration =3D *__begin;
> > statement
> > }
> > }
> >
> > I propose that the range-based for statement is expanded to allow
> iteration
> > through multiple for-range-initializes simultaneously, with
> > for ( for-range-declaration : for-range-initializer;
> for-range-declaration2
> > : for-range-initializer2 /*; ...*/) statement
>
>
> This is https://cplusplus.github.io/EWG/ewg-active.html#43
> and there's also
> http://open-std.org/JTC1/SC22/WG21/docs/papers/2015/p0026r0.pdf
> which was reviewed in Jacksonville but put on hold for now, pending
> further investigations
> on whether a library approach is in all aspects superior.
>
>
As pointed in the proposal, there was a discussion in this group for this
proposal (so you might look in it for details about what was already
considered).
Also noted in it is the special implementation of `for_each( in_parrallel(
range_a, range_b ... ) )` that I wrote
to show one possible implemenation that is similar to (but not exactly
like, because lazy) zipping ranges.
See: http://melpon.org/wandbox/permlink/gqhKDPZNl0Bp3mMA
I believe that the same idea could be done in very more simple ways with
RangeV3 but I do not have practical experience with it yet.
The official issue report notes that there is great interest but not much
work done.
I believe that this proposal was not worked more because of a mix of
personal reasons of the author, lack of time and of champion.
I never heard that there was a rebuttal because of another feature, but I
might be wrong.
Jo=C3=ABl Lamotte
--=20
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 e=
mail 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/CAOU91OO_%3DGz5nW8W%2BUNU_sEGbehQhwf0k9qyGK22_ZO=
N_Y9%2BHQ%40mail.gmail.com.
--001a11423eead3b2c80539ab0e78
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><div class=3D"gmail_quo=
te">On 7 August 2016 at 23:34, Ville Voutilainen <span dir=3D"ltr"><<a h=
ref=3D"mailto:ville.voutilainen@gmail.com" target=3D"_blank">ville.voutilai=
nen@gmail.com</a>></span> wrote:<br><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padd=
ing-left:1ex"><span class=3D"">On 7 August 2016 at 23:49, Antonio Perez <=
;<a href=3D"mailto:antonio@perezexcelsior.com">antonio@perezexcelsior.com</=
a>> wrote:<br>
> Currently, the range-based for statement, defined in section 6.5.4 of =
the<br>
> C++ international Standard, is defined as follows:<br>
><br>
>=C2=A0 The range-based for statement<br>
> for ( for-range-declaration : for-range-initializer ) statement<br>
> is equivalent to<br>
> {<br>
>=C2=A0 =C2=A0 =C2=A0auto &&__range =3D for-range-initializer ;<=
br>
>=C2=A0 =C2=A0 =C2=A0auto __begin =3D begin-expr ;<br>
>=C2=A0 =C2=A0 =C2=A0auto __end =3D end-expr ;<br>
>=C2=A0 =C2=A0 =C2=A0for ( ; __begin !=3D __end; ++__begin ) {<br>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for-range-declaration =3D *__begin;<b=
r>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0statement<br>
>=C2=A0 =C2=A0 =C2=A0}<br>
> }<br>
><br>
> I propose that the range-based for statement is expanded to allow iter=
ation<br>
> through multiple for-range-initializes simultaneously, with<br>
> for ( for-range-declaration : for-range-initializer; for-range-declara=
tion2<br>
> : for-range-initializer2 /*; ...*/) statement<br>
<br>
<br>
</span>This is <a href=3D"https://cplusplus.github.io/EWG/ewg-active.html#4=
3" rel=3D"noreferrer" target=3D"_blank">https://cplusplus.github.io/<wbr>EW=
G/ewg-active.html#43</a><br>
and there's also<br>
<a href=3D"http://open-std.org/JTC1/SC22/WG21/docs/papers/2015/p0026r0.pdf"=
rel=3D"noreferrer" target=3D"_blank">http://open-std.org/JTC1/SC22/<wbr>WG=
21/docs/papers/2015/p0026r0.<wbr>pdf</a><br>
which was reviewed in Jacksonville but put on hold for now, pending<br>
further investigations<br>
on whether a library approach is in all aspects superior.<br>
<span class=3D""><br></span></blockquote><div><br></div><div><br></div><div=
><br></div><div>As pointed =C2=A0in the proposal, there was a discussion in=
this group for this proposal (so you might look in it for details about wh=
at was already</div><div>considered).</div><div>Also noted in it is the spe=
cial implementation of `for_each( in_parrallel( range_a, range_b ... ) )` t=
hat I wrote</div><div>to show one possible implemenation that is similar to=
(but not exactly like, because lazy) zipping ranges.</div><div>See: <a hre=
f=3D"http://melpon.org/wandbox/permlink/gqhKDPZNl0Bp3mMA">http://melpon.org=
/wandbox/permlink/gqhKDPZNl0Bp3mMA</a><br></div><div><br></div><div>I belie=
ve that the same idea could be done in very more simple ways with RangeV3 b=
ut I do not have practical experience with it yet.</div><div>The official i=
ssue report notes that there is great interest but not much work done.</div=
><div>I believe that this proposal was not worked more because of a mix of =
personal reasons of the author, lack of time and of champion.</div><div>I n=
ever heard that there was a rebuttal because of another feature, but I migh=
t be wrong.</div><div><br></div><div>Jo=C3=ABl Lamotte</div><div><br></div>=
<div><br></div></div></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/CAOU91OO_%3DGz5nW8W%2BUNU_sEGbehQhwf0=
k9qyGK22_ZON_Y9%2BHQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoote=
r">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAOU91OO_%3=
DGz5nW8W%2BUNU_sEGbehQhwf0k9qyGK22_ZON_Y9%2BHQ%40mail.gmail.com</a>.<br />
--001a11423eead3b2c80539ab0e78--
.
Author: Izzy Coding <matthew.i.greenwood@gmail.com>
Date: Tue, 9 Aug 2016 21:59:27 -0700 (PDT)
Raw View
------=_Part_5849_396010420.1470805167264
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
As the author of the original proposal, other than the discussion reference=
d, I have had no interest from anyone to either champion or help do any oth=
er work to improve the proposal.
I read that my paper was read and considered, but was not adopted due to ot=
her work being done which would offer similar possibilities (I believe it w=
as about the ranges v3).
My initial argument was that with a relatively simple change we could suppo=
rt looping multiple "ranges" directly in the language rather than making it=
a library feature. All the library options could still be usable and so th=
is proposal would not affect anything. To me combining multiple ranges in a=
wrapper range still feels to me like mixing concerns.
E.G.
for (auto i =3D 0; i < min(range1.length, range2.length; ++i)
{
auto&& item1 =3D range1[i];
auto&& item2 =3D range2[i];
doSomethingWith(item1);
doSomethingRelatedButNotDirectlyConnectedWith(item2);
}
In this case other than doing 2 things in a single loop there is no direct =
connection between the two items. This would allow for multiple processes t=
hat maybe require a transaction. For example the usual financial example, a=
n international account transaction maybe where range1 relates to amounts s=
pent from a given account in one currency, range2 relates to the amount in =
another currency to pay into account 2. Account 1 and Account2 have nothing=
to do with each other than the transaction itself. I agree this is not the=
best way to design a system, but lots of us working on real code bases can=
't always change the legacy code that puts us in this position.
Personally I have always been available for comments and ideas on my propos=
al. Yes I had some personal things going on but I still have not had any in=
terest at all thus far. Not even from the many people I have emailed it to.=
Not even a reply email to say "thanks but no thanks" or whatever.
--=20
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 e=
mail 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/02cbf744-a192-4bb1-bcb7-d98c3d6464f8%40isocpp.or=
g.
------=_Part_5849_396010420.1470805167264--
.
Author: Arthur O'Dwyer <arthur.j.odwyer@gmail.com>
Date: Tue, 9 Aug 2016 22:52:33 -0700 (PDT)
Raw View
------=_Part_412_1882445071.1470808353702
Content-Type: multipart/alternative;
boundary="----=_Part_413_352954467.1470808353702"
------=_Part_413_352954467.1470808353702
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Tuesday, August 9, 2016 at 9:59:27 PM UTC-7, Izzy Coding wrote:
>
> As the author of the original proposal, other than the discussion=20
> referenced, I have had no interest from anyone to either champion or help=
=20
> do any other work to improve the proposal.
> I read that my paper was read and considered, but was not adopted due to=
=20
> other work being done which would offer similar possibilities (I believe =
it=20
> was about the ranges v3).
>
> My initial argument was that with a relatively simple change we could=20
> support looping multiple "ranges" directly in the language rather than=20
> making it a library feature. All the library options could still be usabl=
e=20
> and so this proposal would not affect anything. To me combining multiple=
=20
> ranges in a wrapper range still feels to me like mixing concerns.
>
FWIW, I think there's been no interest because the proposal actually isn't=
=20
a good idea.
Like, it's not laziness or cliquishness or personal animosity, it's just=20
that your proposed feature doesn't sound like a good idea.
I think Nicol had a very good point when he pointed out that the very idea=
=20
of "iterate over two ranges" conflates two different concerns: there's the=
=20
idea of "how many input ranges do I have", and then separately from that,=
=20
there's "how do I aggregate them into something iterable."
For example, you might want
for (auto i =3D 0; i < min(range1.length, range2.length); ++i)
> {
> auto&& item1 =3D range1[i];
> auto&& item2 =3D range2[i];
>
> doSomethingWith(item1);
>
> doSomethingRelatedButNotDirectlyConnectedWith(item2);
> }
>
but then again you might want
for (auto i =3D 0; i < max(range1.length, range2.length); ++i) ... //=
=20
presumably pad the shorter range, whichever it is
or
for (auto i =3D 0; i < assert_equality(range1.length, range2.length);=
=20
++i) ...
or
for (auto i =3D 0; i < sum(range1.length, range2.length); ++i) ... //=
=20
presumably concatenate the ranges
The particular way in which you aggregate the two ranges together is=20
actually a very important parametrizable quantity. It's not clear why "min"=
=20
ought to be privileged with a special language syntax but "max" not be.
But if we let the aggregation function be a parameter, and then we notice=
=20
that assert_equality corresponds basically to zip() and sum corresponds=20
basically to concat() and we start filling in missing primitives... well,=
=20
before long, we've invented Ranges V3. ;)
So the natural inclination of Committee-folks is probably something like=20
"Ranges exists and/or is coming; core language changes are hard; this core=
=20
language change is both incomplete/asymmetric *and* redundant with Ranges;=
=20
so, no." If you think the proposal is good (which, again, I don't, so I=20
think you should drop it), then you're going to have to figure out a way to=
=20
change folks' minds.
=20
> I agree this is not the best way to design a system, but lots of us=20
> working on real code bases can't always change the legacy code that puts =
us=20
> in this position.
>
If you're proposing a core language change, DO NOT use the words "legacy=20
code". Legacy code by definition can't be rewritten to use C++2w features;=
=20
if it could, then you could equally well rewrite it to use Ranges, right=20
now. "Legacy code" is the magic phrase you should use when you are=20
defending AGAINST a core language change (among other situations). See=20
also: auto, static_assert.
Personally I have always been available for comments and ideas on my=20
> proposal. Yes I had some personal things going on but I still have not ha=
d=20
> any interest at all thus far. Not even from the many people I have emaile=
d=20
> it to. Not even a reply email to say "thanks but no thanks" or whatever.
>
I'd venture that most software engineers of the caliber that hang out on=20
this list (probably including yourself) get multiple emails a week =E2=80=
=94 from=20
recruiters, or autograph-seekers, or software salespeople, or whatever =E2=
=80=94 to=20
which the most socially appropriate response is "skim, delete, never=20
reply." After a few years of that routine, some people might come to the=
=20
opinion that "skim, delete, never reply" is also the most socially=20
appropriate response to *any* kind of unwelcome proposal. Experienced=20
recruiters, salespeople, etc., are conditioned over many years to expect=20
"no reply" to 90% of their cold calls. Core-language-feature-proposers=20
might save some of their own sanity by expecting likewise. ;) Life is what=
=20
it is.
HTH,
=E2=80=93Arthur
--=20
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 e=
mail 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/2d388706-0c16-4dd6-a3bf-57798da3d5ca%40isocpp.or=
g.
------=_Part_413_352954467.1470808353702
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Tuesday, August 9, 2016 at 9:59:27 PM UTC-7, Izzy Codin=
g wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0=
..8ex;border-left: 1px #ccc solid;padding-left: 1ex;">As the author of the o=
riginal proposal, other than the discussion referenced, I have had no inter=
est from anyone to either champion or help do any other work to improve the=
proposal.<br>I read that my paper was read and considered, but was not ado=
pted due to other work being done which would offer similar possibilities (=
I believe it was about the ranges v3).<p>My initial argument was that with =
a relatively simple change we could support looping multiple "ranges&q=
uot; directly in the language rather than making it a library feature. All =
the library options could still be usable and so this proposal would not af=
fect anything. To me combining multiple ranges in a wrapper range still fee=
ls to me like mixing concerns.</p></blockquote><div><br></div><div>FWIW, I =
think there's been no interest because the proposal actually isn't =
a good idea.</div><div>Like, it's not laziness or cliquishness or perso=
nal animosity, it's just that your proposed feature doesn't sound l=
ike a good idea.</div><div><br></div><div>I think Nicol had a very good poi=
nt when he pointed out that the very idea of "iterate over two ranges&=
quot; conflates two different concerns: there's the idea of "how m=
any input ranges do I have", and then separately from that, there'=
s "how do I aggregate them into something iterable."</div><div><b=
r></div><div>For example, you might want</div><div><br></div><blockquote cl=
ass=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px =
#ccc solid;padding-left: 1ex;"><p>for (auto i =3D 0; i < min(range1.leng=
th, range2.length); ++i)<br>{<br>=C2=A0 =C2=A0 auto&& item1 =3D ran=
ge1[i];<br>=C2=A0 =C2=A0 auto&& item2 =3D range2[i];</p><p>=C2=A0 =
=C2=A0 doSomethingWith(item1);</p><p>=C2=A0 =C2=A0 doSomethingRelatedButNot=
Direct<wbr>lyConnectedWith(item2);<br>}</p></blockquote><div><br></div><div=
>but then again you might want</div><div><p>=C2=A0 =C2=A0 for (auto i =3D 0=
; i < max(range1.length, range2.length); ++i) ... =C2=A0// presumably pa=
d the shorter range, whichever it is<br></p></div><div>or</div><div><div><p=
>=C2=A0 =C2=A0 for (auto i =3D 0; i < assert_equality(range1.length, ran=
ge2.length); ++i) ...</p><p>or<br></p></div></div><div><p>=C2=A0 =C2=A0 for=
(auto i =3D 0; i < sum(range1.length, range2.length); ++i) ... =C2=A0 /=
/ presumably concatenate the ranges<br></p><p><br></p><p>The particular way=
in which you aggregate the two ranges together is actually a very importan=
t parametrizable quantity. It's not clear why "min" ought to =
be privileged with a special language syntax but "max" not be.</p=
><p><br></p><p>But if we let the aggregation function be a parameter, and t=
hen we notice that assert_equality corresponds basically to zip() and sum c=
orresponds basically to concat() and we start filling in missing primitives=
.... well, before long, we've invented Ranges V3. ;)</p><p><br></p><p>So=
the natural inclination of Committee-folks is probably something like &quo=
t;Ranges exists and/or is coming; core language changes are hard; this core=
language change is both incomplete/asymmetric *and* redundant with Ranges;=
so, no." =C2=A0If you think the proposal is good (which, again, I don=
't, so I think you should drop it), then you're going to have to fi=
gure out a way to change folks' minds.</p><p><br></p></div><div>=C2=A0<=
/div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8e=
x;border-left: 1px #ccc solid;padding-left: 1ex;"><p>I agree this is not th=
e best way to design a system, but lots of us working on real code bases ca=
n't always change the legacy code that puts us in this position.</p></b=
lockquote><div><br></div><div>If you're proposing a core language chang=
e, DO NOT use the words "legacy code". Legacy code by definition =
can't be rewritten to use C++2w features; if it could, then you could e=
qually well rewrite it to use Ranges, right now. =C2=A0"Legacy code&qu=
ot; is the magic phrase you should use when you are defending AGAINST a cor=
e language change (among other situations). See also: auto, static_assert.<=
/div><div><br></div><div><br></div><blockquote class=3D"gmail_quote" style=
=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: =
1ex;"><p>Personally I have always been available for comments and ideas on =
my proposal. Yes I had some personal things going on but I still have not h=
ad any interest at all thus far. Not even from the many people I have email=
ed it to. Not even a reply email to say "thanks but no thanks" or=
whatever.<br></p></blockquote><div><br></div><div>I'd venture that mos=
t software engineers of the caliber that hang out on this list (probably in=
cluding yourself) get multiple emails a week =E2=80=94 from recruiters, or =
autograph-seekers, or software salespeople, or whatever =E2=80=94 to which =
the most socially appropriate response is "skim, delete, never reply.&=
quot; =C2=A0After a few years of that routine, some people might come to th=
e opinion that "skim, delete, never reply" is also the most socia=
lly appropriate response to <i>any</i> kind of unwelcome proposal. =C2=A0Ex=
perienced recruiters, salespeople, etc., are conditioned over many years to=
expect "no reply" to 90% of their cold calls. Core-language-feat=
ure-proposers might save some of their own sanity by expecting likewise. ;)=
=C2=A0Life is what it is.</div><div><br></div><div>HTH,</div><div>=E2=80=
=93Arthur</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/2d388706-0c16-4dd6-a3bf-57798da3d5ca%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/2d388706-0c16-4dd6-a3bf-57798da3d5ca=
%40isocpp.org</a>.<br />
------=_Part_413_352954467.1470808353702--
------=_Part_412_1882445071.1470808353702--
.
Author: Matthew Greenwood <matthew.i.greenwood@gmail.com>
Date: Wed, 10 Aug 2016 10:28:16 +0100
Raw View
--Apple-Mail-BBD74C6F-3F10-46BC-A61A-5AB2CFB7BFC7
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
I agree it is not a good idea anymore given the work on the ranges proposal=
..
The "min" in my example was for illustration only and I agree other forms o=
f iteration are and should be possible.
I was not taking personal offence in any way. I was merely trying to say th=
at given the proposal was on the list for discussion and that my contact de=
tails are in the proposal so that it was possible to have input.
I do understand the "skim, delete, never reply" process to emails. I was ju=
st stating what I had done to try and get extra feedback.
Given the current continuing work in other areas my original proposal is pr=
etty much useless. I don't see the point in having multiple ways to do the =
same thing. That is just asking for abuse. Also the current library impleme=
ntation direction would be much easier, extensible and quicker to get ratif=
ied and reduces the need for extra language rules. Also as you point out it=
could also be usable by earlier versions of the standard which would negat=
e the requirement of rewriting legacy code.
On my previous project which inspired the initial proposal all our componen=
ts were windows based and communicated through COM so the difference in com=
piler was rather agnostic. However, this would have been a limitation to ot=
her platforms. The library option is definitely the way to go in my opinion=
..
> On 10 Aug 2016, at 06:52, Arthur O'Dwyer <arthur.j.odwyer@gmail.com> wrot=
e:
>=20
>> On Tuesday, August 9, 2016 at 9:59:27 PM UTC-7, Izzy Coding wrote:
>> As the author of the original proposal, other than the discussion refere=
nced, I have had no interest from anyone to either champion or help do any =
other work to improve the proposal.
>> I read that my paper was read and considered, but was not adopted due to=
other work being done which would offer similar possibilities (I believe i=
t was about the ranges v3).
>> My initial argument was that with a relatively simple change we could su=
pport looping multiple "ranges" directly in the language rather than making=
it a library feature. All the library options could still be usable and so=
this proposal would not affect anything. To me combining multiple ranges i=
n a wrapper range still feels to me like mixing concerns.
>>=20
>=20
> FWIW, I think there's been no interest because the proposal actually isn'=
t a good idea.
> Like, it's not laziness or cliquishness or personal animosity, it's just =
that your proposed feature doesn't sound like a good idea.
>=20
> I think Nicol had a very good point when he pointed out that the very ide=
a of "iterate over two ranges" conflates two different concerns: there's th=
e idea of "how many input ranges do I have", and then separately from that,=
there's "how do I aggregate them into something iterable."
>=20
> For example, you might want
>=20
>> for (auto i =3D 0; i < min(range1.length, range2.length); ++i)
>> {
>> auto&& item1 =3D range1[i];
>> auto&& item2 =3D range2[i];
>>=20
>> doSomethingWith(item1);
>>=20
>> doSomethingRelatedButNotDirectlyConnectedWith(item2);
>> }
>>=20
>=20
> but then again you might want
> for (auto i =3D 0; i < max(range1.length, range2.length); ++i) ... /=
/ presumably pad the shorter range, whichever it is
>=20
> or
> for (auto i =3D 0; i < assert_equality(range1.length, range2.length);=
++i) ...
>=20
> or
>=20
> for (auto i =3D 0; i < sum(range1.length, range2.length); ++i) ... =
// presumably concatenate the ranges
>=20
>=20
>=20
> The particular way in which you aggregate the two ranges together is actu=
ally a very important parametrizable quantity. It's not clear why "min" oug=
ht to be privileged with a special language syntax but "max" not be.
>=20
>=20
>=20
> But if we let the aggregation function be a parameter, and then we notice=
that assert_equality corresponds basically to zip() and sum corresponds ba=
sically to concat() and we start filling in missing primitives... well, bef=
ore long, we've invented Ranges V3. ;)
>=20
>=20
>=20
> So the natural inclination of Committee-folks is probably something like =
"Ranges exists and/or is coming; core language changes are hard; this core =
language change is both incomplete/asymmetric *and* redundant with Ranges; =
so, no." If you think the proposal is good (which, again, I don't, so I th=
ink you should drop it), then you're going to have to figure out a way to c=
hange folks' minds.
>=20
>=20
>=20
> =20
>> I agree this is not the best way to design a system, but lots of us work=
ing on real code bases can't always change the legacy code that puts us in =
this position.
>>=20
>=20
> If you're proposing a core language change, DO NOT use the words "legacy =
code". Legacy code by definition can't be rewritten to use C++2w features; =
if it could, then you could equally well rewrite it to use Ranges, right no=
w. "Legacy code" is the magic phrase you should use when you are defending=
AGAINST a core language change (among other situations). See also: auto, s=
tatic_assert.
>=20
>=20
>> Personally I have always been available for comments and ideas on my pro=
posal. Yes I had some personal things going on but I still have not had any=
interest at all thus far. Not even from the many people I have emailed it =
to. Not even a reply email to say "thanks but no thanks" or whatever.
>>=20
>=20
> I'd venture that most software engineers of the caliber that hang out on =
this list (probably including yourself) get multiple emails a week =E2=80=
=94 from recruiters, or autograph-seekers, or software salespeople, or what=
ever =E2=80=94 to which the most socially appropriate response is "skim, de=
lete, never reply." After a few years of that routine, some people might c=
ome to the opinion that "skim, delete, never reply" is also the most social=
ly appropriate response to any kind of unwelcome proposal. Experienced rec=
ruiters, salespeople, etc., are conditioned over many years to expect "no r=
eply" to 90% of their cold calls. Core-language-feature-proposers might sav=
e some of their own sanity by expecting likewise. ;) Life is what it is.
>=20
> HTH,
> =E2=80=93Arthur
> --=20
> You received this message because you are subscribed to a topic in the Go=
ogle Groups "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this topic, visit https://groups.google.com/a/isocpp.=
org/d/topic/std-proposals/TqfLLDb6DW0/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to std-p=
roposals+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/isoc=
pp.org/d/msgid/std-proposals/2d388706-0c16-4dd6-a3bf-57798da3d5ca%40isocpp.=
org.
--=20
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 e=
mail 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/54703567-79B1-4BAE-A715-1AB1462D7188%40gmail.com=
..
--Apple-Mail-BBD74C6F-3F10-46BC-A61A-5AB2CFB7BFC7
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<html><head><meta http-equiv=3D"content-type" content=3D"text/html; charset=
=3Dutf-8"></head><body dir=3D"auto"><div>I agree it is not a good idea anym=
ore given the work on the ranges proposal.</div><div id=3D"AppleMailSignatu=
re"><br></div><div id=3D"AppleMailSignature">The "min" in my example was fo=
r illustration only and I agree other forms of iteration are and should be =
possible.</div><div id=3D"AppleMailSignature"><br></div><div id=3D"AppleMai=
lSignature">I was not taking personal offence in any way. I was merely tryi=
ng to say that given the proposal was on the list for discussion and that m=
y contact details are in the proposal so that it was possible to have input=
..</div><div id=3D"AppleMailSignature"><br></div><div id=3D"AppleMailSignatu=
re">I do understand the "skim, delete, never reply" process to emails. I wa=
s just stating what I had done to try and get extra feedback.</div><div id=
=3D"AppleMailSignature"><br></div><div id=3D"AppleMailSignature">Given the =
current continuing work in other areas my original proposal is pretty much =
useless. I don't see the point in having multiple ways to do the same thing=
.. That is just asking for abuse. Also the current library implementation di=
rection would be much easier, extensible and quicker to get ratified and re=
duces the need for extra language rules. Also as you point out it could als=
o be usable by earlier versions of the standard which would negate the requ=
irement of rewriting legacy code.</div><div id=3D"AppleMailSignature"><br><=
/div><div id=3D"AppleMailSignature">On my previous project which inspired t=
he initial proposal all our components were windows based and communicated =
through COM so the difference in compiler was rather agnostic. However, thi=
s would have been a limitation to other platforms. The library option is de=
finitely the way to go in my opinion.</div><div><br>On 10 Aug 2016, at 06:5=
2, Arthur O'Dwyer <<a href=3D"mailto:arthur.j.odwyer@gmail.com">arthur.j=
..odwyer@gmail.com</a>> wrote:<br><br></div><blockquote type=3D"cite"><di=
v><div dir=3D"ltr">On Tuesday, August 9, 2016 at 9:59:27 PM UTC-7, Izzy Cod=
ing wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left:=
0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">As the author of the=
original proposal, other than the discussion referenced, I have had no int=
erest from anyone to either champion or help do any other work to improve t=
he proposal.<br>I read that my paper was read and considered, but was not a=
dopted due to other work being done which would offer similar possibilities=
(I believe it was about the ranges v3).<p>My initial argument was that wit=
h a relatively simple change we could support looping multiple "ranges" dir=
ectly in the language rather than making it a library feature. All the libr=
ary options could still be usable and so this proposal would not affect any=
thing. To me combining multiple ranges in a wrapper range still feels to me=
like mixing concerns.</p></blockquote><div><br></div><div>FWIW, I think th=
ere's been no interest because the proposal actually isn't a good idea.</di=
v><div>Like, it's not laziness or cliquishness or personal animosity, it's =
just that your proposed feature doesn't sound like a good idea.</div><div><=
br></div><div>I think Nicol had a very good point when he pointed out that =
the very idea of "iterate over two ranges" conflates two different concerns=
: there's the idea of "how many input ranges do I have", and then separatel=
y from that, there's "how do I aggregate them into something iterable."</di=
v><div><br></div><div>For example, you might want</div><div><br></div><bloc=
kquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-l=
eft: 1px #ccc solid;padding-left: 1ex;"><p>for (auto i =3D 0; i < min(ra=
nge1.length, range2.length); ++i)<br>{<br> auto&& item=
1 =3D range1[i];<br> auto&& item2 =3D range2[i];</p><p=
> doSomethingWith(item1);</p><p> doSomethingRelat=
edButNotDirect<wbr>lyConnectedWith(item2);<br>}</p></blockquote><div><br></=
div><div>but then again you might want</div><div><p> for (auto=
i =3D 0; i < max(range1.length, range2.length); ++i) ... // presu=
mably pad the shorter range, whichever it is<br></p></div><div>or</div><div=
><div><p> for (auto i =3D 0; i < assert_equality(range1.len=
gth, range2.length); ++i) ...</p><p>or<br></p></div></div><div><p> &n=
bsp; for (auto i =3D 0; i < sum(range1.length, range2.length); ++i) ... =
// presumably concatenate the ranges<br></p><p><br></p><p>The partic=
ular way in which you aggregate the two ranges together is actually a very =
important parametrizable quantity. It's not clear why "min" ought to be pri=
vileged with a special language syntax but "max" not be.</p><p><br></p><p>B=
ut if we let the aggregation function be a parameter, and then we notice th=
at assert_equality corresponds basically to zip() and sum corresponds basic=
ally to concat() and we start filling in missing primitives... well, before=
long, we've invented Ranges V3. ;)</p><p><br></p><p>So the natural inclina=
tion of Committee-folks is probably something like "Ranges exists and/or is=
coming; core language changes are hard; this core language change is both =
incomplete/asymmetric *and* redundant with Ranges; so, no." If you th=
ink the proposal is good (which, again, I don't, so I think you should drop=
it), then you're going to have to figure out a way to change folks' minds.=
</p><p><br></p></div><div> </div><blockquote class=3D"gmail_quote" sty=
le=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left=
: 1ex;"><p>I agree this is not the best way to design a system, but lots of=
us working on real code bases can't always change the legacy code that put=
s us in this position.</p></blockquote><div><br></div><div>If you're propos=
ing a core language change, DO NOT use the words "legacy code". Legacy code=
by definition can't be rewritten to use C++2w features; if it could, then =
you could equally well rewrite it to use Ranges, right now. "Legacy c=
ode" is the magic phrase you should use when you are defending AGAINST a co=
re language change (among other situations). See also: auto, static_assert.=
</div><div><br></div><div><br></div><blockquote class=3D"gmail_quote" style=
=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: =
1ex;"><p>Personally I have always been available for comments and ideas on =
my proposal. Yes I had some personal things going on but I still have not h=
ad any interest at all thus far. Not even from the many people I have email=
ed it to. Not even a reply email to say "thanks but no thanks" or whatever.=
</p><br><p></p></blockquote><div><br></div><div>I'd venture that most softw=
are engineers of the caliber that hang out on this list (probably including=
yourself) get multiple emails a week =E2=80=94 from recruiters, or autogra=
ph-seekers, or software salespeople, or whatever =E2=80=94 to which the mos=
t socially appropriate response is "skim, delete, never reply." After=
a few years of that routine, some people might come to the opinion that "s=
kim, delete, never reply" is also the most socially appropriate response to=
<i>any</i> kind of unwelcome proposal. Experienced recruiters, sales=
people, etc., are conditioned over many years to expect "no reply" to 90% o=
f their cold calls. Core-language-feature-proposers might save some of thei=
r own sanity by expecting likewise. ;) Life is what it is.</div><div>=
<br></div><div>HTH,</div><div>=E2=80=93Arthur</div></div>
<p></p>
-- <br>
You received this message because you are subscribed to a topic in the Goog=
le Groups "ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this topic, visit <a href=3D"https://groups.google.com/=
a/isocpp.org/d/topic/std-proposals/TqfLLDb6DW0/unsubscribe">https://groups.=
google.com/a/isocpp.org/d/topic/std-proposals/TqfLLDb6DW0/unsubscribe</a>.<=
br>
To unsubscribe from this group and all its topics, send an email to <a href=
=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposals+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/2d388706-0c16-4dd6-a3bf-57798da3d5ca%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.goo=
gle.com/a/isocpp.org/d/msgid/std-proposals/2d388706-0c16-4dd6-a3bf-57798da3=
d5ca%40isocpp.org</a>.<br>
</div></blockquote></body></html>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/54703567-79B1-4BAE-A715-1AB1462D7188%=
40gmail.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/54703567-79B1-4BAE-A715-1AB1462D7188%=
40gmail.com</a>.<br />
--Apple-Mail-BBD74C6F-3F10-46BC-A61A-5AB2CFB7BFC7--
.
Author: Matthew Woehlke <mwoehlke.floss@gmail.com>
Date: Tue, 9 Aug 2016 09:57:43 -0400
Raw View
On 2016-08-08 21:01, Arthur O'Dwyer wrote:
> It looks like in Eric Niebler's Ranges-v3, Matthew's hypothetical std::pad(r,
> v) is spelled ranges::view::concat(r, ranges::view::repeat(v)) .
In fact, I'd even considered writing it in this form. The combination of
concat + repeat is obviously more flexible (and repeat is what Python
uses), and we definitely want these. This combination *may* be common
enough to warrant a shorthand, though; the implementation of such could
just be concat + repeat:
namespace std { // or ranges::view, or whatever
auto pad(auto range, auto pad_element)
{
return concat(range, repeat(pad_element));
}
}
(Please pardon sloppy parameter declarations, above is meant to show the
body, not the declaration.)
--
Matthew
--
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/nocngn%24ott%241%40blaine.gmane.org.
.