Topic: Permit Structured Binding in Reverse


Author: Antonio Perez <antonio@perezexcelsior.com>
Date: Mon, 15 May 2017 02:49:18 -0700 (PDT)
Raw View
------=_Part_1296_420125062.1494841758386
Content-Type: multipart/alternative;
 boundary="----=_Part_1297_1369496751.1494841758387"

------=_Part_1297_1369496751.1494841758387
Content-Type: text/plain; charset="UTF-8"

Structured binding is an extremely useful concept because it allows the
efficent and intuitive unpacking of data-structures into their individual
values, and it works on a wide range of data structures. Not only does it
work on tuples and pairs, but it also works on structs defined by the
programmer without any additional effort on their part. I propose making
this language feature more complete by allowing structured binding to take
place in reverse:

tuple a = {1, 3.7}; //Creates a tuple of type tuple<int, double> with
values 1 and 3.7
tuple b = [1, 3.7]; //Ditto

 *Where is this useful?*
The above example isn't particularly useful, HOWEVER here's a more real
usage case:

[double, double] GetAngleVector(double x)
{
    return [cos(x), sin(x)];
}

//All of these would be 100% valid:
tuple t = GetAngleVector(2.7);
pair p = GetAngleVector(2.7);
array<double, 2> arr = GetAngleVector(2.7);
auto [x,y] = GetAngleVector(2.7);

struct Point2D {
    double x,y;
};
Point2D point = GetAngleVector(2.7);

Here, the function returns a structured-binding that will automatically map
to whatever it's assigned to without issue.


Something similar could be achieved in standard C++17, although it's
unseemly and difficult to read:
tuple<double, double> GetAngleVector(double x)
{
    return {cos(x), sin(x)};
}

//All of these would be 100% valid:
pair p = std::make_from_tuple<pair<double, double>, tuple<double,double>>(
GetAngleVector(2.7));
array<double, 2> arr = std::make_from_tuple<std::array<double, 2>, tuple<
double,double>>(GetAngleVector(2.7));

struct Point2D {
    double x,y;
};
Point2D point = std::make_from_tuple<Point2D, tuple<double,double>>(
GetAngleVector(2.7))


--
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/db270137-954e-4883-904c-0a3eb378b8c3%40isocpp.org.

------=_Part_1297_1369496751.1494841758387
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Structured binding is an extremely useful concept because =
it allows the efficent and intuitive unpacking of data-structures into thei=
r individual values, and it works on a wide range of data structures. Not o=
nly does it work on tuples and pairs, but it also works on structs defined =
by the programmer without any additional effort on their part. I propose ma=
king this language feature more complete by allowing structured binding to =
take place in reverse:<div><br></div><div><div class=3D"prettyprint" style=
=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187);=
 border-style: solid; border-width: 1px; word-wrap: break-word;"><code clas=
s=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #000;=
" class=3D"styled-by-prettify">tuple a </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;" class=3D"style=
d-by-prettify">{</span><span style=3D"color: #066;" class=3D"styled-by-pret=
tify">1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #066;" class=3D"styled-by-prettify">3.7</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">};</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #800;"=
 class=3D"styled-by-prettify">//Creates a tuple of type tuple&lt;int, doubl=
e&gt; with values 1 and 3.7</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br>tuple b </span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">=3D</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: #066;" class=3D"styled-by-prettify">1</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #066;" class=3D"styled-by-prettify">3.7</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">];</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=3D"st=
yled-by-prettify">//Ditto</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br></span></div></code></div><br>=C2=A0<b>Where is this use=
ful?</b></div><div>The above example isn&#39;t particularly useful, HOWEVER=
 here&#39;s a more real usage case:</div><div><br></div><div><div class=3D"=
prettyprint" style=3D"background-color: rgb(250, 250, 250); border-color: r=
gb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: break=
-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">[</span><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">double</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">double</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">]</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">GetA=
ngleVector</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">double</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> x</span><spa=
n 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><span style=3D"color: #000=
;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">return</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">[</span><font color=3D"#000000"><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">cos</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">x</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">),</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> sin</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">x</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">)];</span></fon=
t><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span style=
=3D"color: #800;" class=3D"styled-by-prettify">//All of these would be 100%=
 valid:</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
>tuple t </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: #606;" class=3D"styled-by-prettify">GetAngleVector</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><spa=
n style=3D"color: #066;" class=3D"styled-by-prettify">2.7</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">);</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br>pair p </span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=
=3D"styled-by-prettify">GetAngleVector</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">(</span><span style=3D"color: #066;" class=3D"s=
tyled-by-prettify">2.7</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">);</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"><br>array</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">dou=
ble</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: #066;" class=3D"styled-by-prettify">2</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">&gt;</span><font color=3D"#000000"=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> arr </span><spa=
n 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=
: #606;" class=3D"styled-by-prettify">GetAngleVector</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #06=
6;" class=3D"styled-by-prettify">2.7</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">);</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">auto</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">[</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify">x</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">y</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">=3D</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-pretti=
fy">GetAngleVector</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">(</span><span style=3D"color: #066;" class=3D"styled-by-prettify">2=
..7</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D=
"color: #606;" class=3D"styled-by-prettify">Point2D</span><span style=3D"co=
lor: #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"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">double</span><span style=3D"color: #000;" c=
lass=3D"styled-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">y</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">};</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span styl=
e=3D"color: #606;" class=3D"styled-by-prettify">Point2D</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> point </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: #606;" c=
lass=3D"styled-by-prettify">GetAngleVector</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">(</span><span style=3D"color: #066;" class=
=3D"styled-by-prettify">2.7</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">);</span></font></div></code></div><br>Here, the function =
returns a structured-binding that will automatically map to whatever it&#39=
;s assigned to without issue.=C2=A0</div><div><br></div><div><br></div><div=
>Something similar could be achieved in standard C++17, although it&#39;s u=
nseemly and difficult to read:</div><div><div class=3D"prettyprint" style=
=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187);=
 border-style: solid; border-width: 1px; word-wrap: break-word;"><code clas=
s=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #000;=
" class=3D"styled-by-prettify">tuple</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">double</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">do=
uble</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #606;" class=3D"styled-by-prettify">GetAngleVector</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">double</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> x</span><span style=3D"colo=
r: #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">{</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">return</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><font color=3D"#666600"><span style=3D"color: #=
660;" class=3D"styled-by-prettify">{</span></font><font color=3D"#000000"><=
span style=3D"color: #000;" class=3D"styled-by-prettify">cos</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"co=
lor: #000;" class=3D"styled-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"> sin</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify">x</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
)};</span></font><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span>=
<span style=3D"color: #800;" class=3D"styled-by-prettify">//All of these wo=
uld be 100% valid:</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br>pair p </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">=3D</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 style=3D"color: #000;" class=3D"styled-by-prettify">make_from_tu=
ple</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify">pair</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">double</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: #008;" =
class=3D"styled-by-prettify">double</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">&gt;,</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> tuple</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">double</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">,</span><span style=3D"color: #008;" class=3D"styled-by-prettify">dou=
ble</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;&gt=
;(</span><span style=3D"color: #606;" class=3D"styled-by-prettify">GetAngle=
Vector</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</s=
pan><span style=3D"color: #066;" class=3D"styled-by-prettify">2.7</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">));</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"><br>array</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">double</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> </span><span style=3D"color: #066;" class=3D"s=
tyled-by-prettify">2</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">&gt;</span><font color=3D"#000000"><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> arr </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span></font><span style=3D"color: #000;" class=3D"style=
d-by-prettify">std</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
make_from_tuple</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">s=
td</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">array</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">double</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: #066;" cla=
ss=3D"styled-by-prettify">2</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">&gt;,</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> tuple</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">double</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,<=
/span><span style=3D"color: #008;" class=3D"styled-by-prettify">double</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;&gt;(</span=
><span style=3D"color: #606;" class=3D"styled-by-prettify">GetAngleVector</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><spa=
n style=3D"color: #066;" class=3D"styled-by-prettify">2.7</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">));</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br></span><font color=3D"#000000">=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span =
style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #606;" class=3D"styled-by-prettify">Point2D</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">double</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> x</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify">y</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">};</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D=
"color: #606;" class=3D"styled-by-prettify">Point2D</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> point </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span></font><span style=3D"color: #000;" =
class=3D"styled-by-prettify">std</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">make_from_tuple</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">&lt;</span><font color=3D"#000000"><span style=3D"colo=
r: #606;" class=3D"styled-by-prettify">Point2D</span></font><span style=3D"=
color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> tuple</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">double</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">,</span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">double</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">&gt;&gt;(</span><span style=3D"color: #606;" class=3D"styled-by-pret=
tify">GetAngleVector</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">(</span><span style=3D"color: #066;" class=3D"styled-by-prettify"=
>2.7</span><span style=3D"color: #660;" class=3D"styled-by-prettify">))</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></d=
iv></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&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/db270137-954e-4883-904c-0a3eb378b8c3%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/db270137-954e-4883-904c-0a3eb378b8c3=
%40isocpp.org</a>.<br />

------=_Part_1297_1369496751.1494841758387--

------=_Part_1296_420125062.1494841758386--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Mon, 15 May 2017 13:37:48 +0300
Raw View
On 15 May 2017 at 12:49, Antonio Perez <antonio@perezexcelsior.com> wrote:
> Structured binding is an extremely useful concept because it allows the
> efficent and intuitive unpacking of data-structures into their individual
> values, and it works on a wide range of data structures. Not only does it
> work on tuples and pairs, but it also works on structs defined by the
> programmer without any additional effort on their part. I propose making
> this language feature more complete by allowing structured binding to take
> place in reverse:
>
> tuple a = {1, 3.7}; //Creates a tuple of type tuple<int, double> with values
> 1 and 3.7
> tuple b = [1, 3.7]; //Ditto
>
>  Where is this useful?
> The above example isn't particularly useful, HOWEVER here's a more real
> usage case:
>
> [double, double] GetAngleVector(double x)
> {
>     return [cos(x), sin(x)];
> }
>
> //All of these would be 100% valid:
> tuple t = GetAngleVector(2.7);
> pair p = GetAngleVector(2.7);
> array<double, 2> arr = GetAngleVector(2.7);
> auto [x,y] = GetAngleVector(2.7);


Interesting. The way I looked at that idea was like this: "we want to
make it easy to allow
initializing an object from an object of tuple-like type if the first
object can be initialized with a structured binding
decomposition of that tuple-like type". More concretely,
1) overload-resolve the initialization as usual
2) if that fails, try the structured binding approach

Semi-obvious questions:
a) can we just do it as a language feature like that..
b) ..or should it be an "opt-in"?
c) how does it interact with class template argument deduction?
Probably quite well, because
pair p = GetAngleVector(2.9);
isn't valid, so the fallback mechanism would eventually kick in, do
structured bindings for the source
and deduce pair<int, double>.

--
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/CAFk2RUbj6Os5c4phxkA_ib23od4JfVWpWadV_Sv%2B0YHAYdW%2B1Q%40mail.gmail.com.

.


Author: Antonio Perez <antonio@perezexcelsior.com>
Date: Mon, 15 May 2017 04:45:28 -0700 (PDT)
Raw View
------=_Part_1343_1125434871.1494848728979
Content-Type: multipart/alternative;
 boundary="----=_Part_1344_1019129708.1494848728980"

------=_Part_1344_1019129708.1494848728980
Content-Type: text/plain; charset="UTF-8"

Oh! It would interact with normal template argument deduction very nicely.
In most cases, the [] brackets could just be replaced with curly braces:

pair p = [2,"Hello world"];
array<double, 3> arr = [3.7, 9.2, 8.1];
Would be equivalent to:
pair p = {2, "Hello world"};
array<double, 3> arr = {3.7, 9.2, 8.1};

Correspondingly,
[double, double] GetAngleVector(double x)
{
    return [cos(x), sin(x)];
}
tuple t = GetAngleVector(2.7);
pair p = GetAngleVector(2.7);
array<double, 2> arr = GetAngleVector(2.7);
Would be equivalent to:
template<class T> T GetAngleVector(double x)
{
    return T{cos(x), sin(x)};
}
tuple t = GetAngleVector<tuple<double, double>>(2.7);
pair p = GetAngleVector<pair<double, double>>(2.7);
array<double, 2> arr = GetAngleVector<array<double, 2>>(2.7);

However* allowing for reversed structured binding to would mean that the
compiler would only have to compile one function, rather than multiple
separate functions that differed only in their return type. *
In addition, the structured binding syntax makes it more obvious what
exactly's happening. Finally, a structured binding can be directly assigned
to another structured binding, so
auto [x,y] = [3,4.7];
WOULD BE valid, whereas
auto [x,y] = {3,4.7};//Currently causes error
Would cause an error (as it currently does).


On Monday, May 15, 2017 at 4:37:50 AM UTC-6, Ville Voutilainen wrote:
>
> On 15 May 2017 at 12:49, Antonio Perez <ant...@perezexcelsior.com
> <javascript:>> wrote:
> > Structured binding is an extremely useful concept because it allows the
> > efficent and intuitive unpacking of data-structures into their
> individual
> > values, and it works on a wide range of data structures. Not only does
> it
> > work on tuples and pairs, but it also works on structs defined by the
> > programmer without any additional effort on their part. I propose making
> > this language feature more complete by allowing structured binding to
> take
> > place in reverse:
> >
> > tuple a = {1, 3.7}; //Creates a tuple of type tuple<int, double> with
> values
> > 1 and 3.7
> > tuple b = [1, 3.7]; //Ditto
> >
> >  Where is this useful?
> > The above example isn't particularly useful, HOWEVER here's a more real
> > usage case:
> >
> > [double, double] GetAngleVector(double x)
> > {
> >     return [cos(x), sin(x)];
> > }
> >
> > //All of these would be 100% valid:
> > tuple t = GetAngleVector(2.7);
> > pair p = GetAngleVector(2.7);
> > array<double, 2> arr = GetAngleVector(2.7);
> > auto [x,y] = GetAngleVector(2.7);
>
>
> Interesting. The way I looked at that idea was like this: "we want to
> make it easy to allow
> initializing an object from an object of tuple-like type if the first
> object can be initialized with a structured binding
> decomposition of that tuple-like type". More concretely,
> 1) overload-resolve the initialization as usual
> 2) if that fails, try the structured binding approach
>
> Semi-obvious questions:
> a) can we just do it as a language feature like that..
> b) ..or should it be an "opt-in"?
> c) how does it interact with class template argument deduction?
> Probably quite well, because
> pair p = GetAngleVector(2.9);
> isn't valid, so the fallback mechanism would eventually kick in, do
> structured bindings for the source
> and deduce pair<int, double>.
>

--
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/c41537ec-a8e3-42ff-8f88-2c43630c0a06%40isocpp.org.

------=_Part_1344_1019129708.1494848728980
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Oh! It would interact with normal template argument deduct=
ion very nicely. In most cases, the=C2=A0<span style=3D"color: rgb(102, 102=
, 0); font-family: monospace; background-color: rgb(250, 250, 250);">[]</sp=
an>=C2=A0brackets could just be replaced with curly braces:<div><br><div><d=
iv class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); bor=
der-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; word=
-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subprettyprin=
t"><span style=3D"color: #000;" class=3D"styled-by-prettify">pair p </span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">[</span><span style=3D"color: #06=
6;" class=3D"styled-by-prettify">2</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #080;" class=3D"style=
d-by-prettify">&quot;Hello world&quot;</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">];</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br>array</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-=
by-prettify">double</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 </span><font color=3D"#006666"><span style=3D"color: #066;" class=3D"style=
d-by-prettify">3</span></font><span style=3D"color: #660;" class=3D"styled-=
by-prettify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> arr </span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">[</span><span =
style=3D"color: #066;" class=3D"styled-by-prettify">3.7</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: #066;" =
class=3D"styled-by-prettify">9.2</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pret=
tify">8.1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">]=
;</span></div></code></div>Would be equivalent to:<br><div class=3D"prettyp=
rint" style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187,=
 187, 187); border-style: solid; border-width: 1px; word-wrap: break-word;"=
><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">pair p </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><font color=3D"#666600"><span style=
=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color=
: #066;" class=3D"styled-by-prettify">2</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: #080;" class=3D"styled-by=
-prettify">&quot;Hello world&quot;</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">};</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br></span></font><span style=3D"color: #000;" class=3D"sty=
led-by-prettify">array</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">double</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
><font color=3D"#006666"><span style=3D"color: #066;" class=3D"styled-by-pr=
ettify">3</span></font><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 arr </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><fon=
t color=3D"#666600"><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">{</span></font><span style=3D"color: #066;" class=3D"styled-by-prettify"=
>3.7</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #066;" class=3D"styled-by-prettify">9.2</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: #066;" cla=
ss=3D"styled-by-prettify">8.1</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">};</span><font color=3D"#666600"><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br></span></font></div></code></div><di=
v><br></div>Correspondingly,=C2=A0</div><div><div class=3D"prettyprint" sty=
le=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187=
); border-style: solid; border-width: 1px; word-wrap: break-word;"><code cl=
ass=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: rgb=
(102, 102, 0);"><span style=3D"color: #660;" class=3D"styled-by-prettify">[=
</span></span><span style=3D"color: rgb(0, 0, 136);"><span style=3D"color: =
#008;" class=3D"styled-by-prettify">double</span></span><span style=3D"colo=
r: rgb(102, 102, 0);"><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">,</span></span><span style=3D"color: rgb(0, 0, 0);"><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span></span><span style=3D"color=
: rgb(0, 0, 136);"><span style=3D"color: #008;" class=3D"styled-by-prettify=
">double</span></span><span style=3D"color: rgb(102, 102, 0);"><span style=
=3D"color: #660;" class=3D"styled-by-prettify">]</span></span><span style=
=3D"color: rgb(0, 0, 0);"><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span></span><span style=3D"color: rgb(102, 0, 102);"><span styl=
e=3D"color: #606;" class=3D"styled-by-prettify">GetAngleVector</span></span=
><span style=3D"color: rgb(102, 102, 0);"><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">(</span></span><span style=3D"color: rgb(0, 0, 136=
);"><span style=3D"color: #008;" class=3D"styled-by-prettify">double</span>=
</span><span style=3D"color: rgb(0, 0, 0);"><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> x</span></span><span style=3D"color: rgb(102, 1=
02, 0);"><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span>=
</span><span style=3D"color: rgb(0, 0, 0);"><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br></span></span><span style=3D"color: rgb(102,=
 102, 0);"><span style=3D"color: #660;" class=3D"styled-by-prettify">{</spa=
n></span><span style=3D"color: rgb(0, 0, 0);"><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span></span><span style=3D=
"color: rgb(0, 0, 136);"><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">return</span></span><span style=3D"color: rgb(0, 0, 0);"><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span></span><span style=
=3D"color: rgb(102, 102, 0);"><span style=3D"color: #660;" class=3D"styled-=
by-prettify">[</span></span><font color=3D"#000000"><span style=3D"color: #=
000;" class=3D"styled-by-prettify">cos</span><span style=3D"color: rgb(102,=
 102, 0);"><span style=3D"color: #660;" class=3D"styled-by-prettify">(</spa=
n></span><span style=3D"color: #000;" class=3D"styled-by-prettify">x</span>=
<span style=3D"color: rgb(102, 102, 0);"><span style=3D"color: #660;" class=
=3D"styled-by-prettify">),</span></span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> sin</span><span style=3D"color: rgb(102, 102, 0);"=
><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span></span><=
span style=3D"color: #000;" class=3D"styled-by-prettify">x</span><span styl=
e=3D"color: rgb(102, 102, 0);"><span style=3D"color: #660;" class=3D"styled=
-by-prettify">)];</span></span></font><span style=3D"color: rgb(0, 0, 0);">=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></span=
><span style=3D"color: rgb(102, 102, 0);"><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br></span></span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify">tuple t </span><span style=3D"color: rgb(102, 102, 0);"><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span></span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: rgb(102, 0, 102);"><span style=3D"color: #606;" class=3D"styled-=
by-prettify">GetAngleVector</span></span><span style=3D"color: rgb(102, 102=
, 0);"><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span></=
span><span style=3D"color: rgb(0, 102, 102);"><span style=3D"color: #066;" =
class=3D"styled-by-prettify">2.7</span></span><span style=3D"color: rgb(102=
, 102, 0);"><span style=3D"color: #660;" class=3D"styled-by-prettify">);</s=
pan></span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>pa=
ir p </span><span style=3D"color: rgb(102, 102, 0);"><span style=3D"color: =
#660;" class=3D"styled-by-prettify">=3D</span></span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: rgb(102, =
0, 102);"><span style=3D"color: #606;" class=3D"styled-by-prettify">GetAngl=
eVector</span></span><span style=3D"color: rgb(102, 102, 0);"><span style=
=3D"color: #660;" class=3D"styled-by-prettify">(</span></span><span style=
=3D"color: rgb(0, 102, 102);"><span style=3D"color: #066;" class=3D"styled-=
by-prettify">2.7</span></span><span style=3D"color: rgb(102, 102, 0);"><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">);</span></span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"><br>array</span><span =
style=3D"color: rgb(102, 102, 0);"><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">&lt;</span></span><span style=3D"color: rgb(0, 0, 136);">=
<span style=3D"color: #008;" class=3D"styled-by-prettify">double</span></sp=
an><span style=3D"color: rgb(102, 102, 0);"><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">,</span></span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span><span style=3D"color: rgb(0, 102, 102);"><=
span style=3D"color: #066;" class=3D"styled-by-prettify">2</span></span><sp=
an style=3D"color: rgb(102, 102, 0);"><span style=3D"color: #660;" class=3D=
"styled-by-prettify">&gt;</span></span><font color=3D"#000000"><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> arr </span><span style=3D"c=
olor: rgb(102, 102, 0);"><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">=3D</span></span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: rgb(102, 0, 102);"><span style=3D"col=
or: #606;" class=3D"styled-by-prettify">GetAngleVector</span></span><span s=
tyle=3D"color: rgb(102, 102, 0);"><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">(</span></span><span style=3D"color: rgb(0, 102, 102);"><s=
pan style=3D"color: #066;" class=3D"styled-by-prettify">2.7</span></span><s=
pan style=3D"color: rgb(102, 102, 0);"><span style=3D"color: #660;" class=
=3D"styled-by-prettify">);</span></span></font><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"><br></span></div></code></div>Would be equiva=
lent to:</div><div><div class=3D"prettyprint" style=3D"background-color: rg=
b(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; bo=
rder-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div c=
lass=3D"subprettyprint"><span style=3D"color: rgb(0, 0, 0);"><span style=3D=
"color: #008;" class=3D"styled-by-prettify">template</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: =
#008;" class=3D"styled-by-prettify">class</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> T </span></span><span style=3D"color: rgb(102, 0, 102);"=
><span style=3D"color: #606;" class=3D"styled-by-prettify">GetAngleVector</=
span></span><span style=3D"color: rgb(102, 102, 0);"><span style=3D"color: =
#660;" class=3D"styled-by-prettify">(</span></span><span style=3D"color: rg=
b(0, 0, 136);"><span style=3D"color: #008;" class=3D"styled-by-prettify">do=
uble</span></span><span style=3D"color: rgb(0, 0, 0);"><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> x</span></span><span style=3D"color:=
 rgb(102, 102, 0);"><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">)</span></span><span style=3D"color: rgb(0, 0, 0);"><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br></span></span><span style=3D"colo=
r: rgb(102, 102, 0);"><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">{</span></span><span style=3D"color: rgb(0, 0, 0);"><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span></span><sp=
an style=3D"color: rgb(0, 0, 136);"><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">return</span></span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> T</span><font color=3D"#666600"><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">{</span></font><font color=3D"#0000=
00"><span style=3D"color: #000;" class=3D"styled-by-prettify">cos</span><sp=
an style=3D"color: rgb(102, 102, 0);"><span style=3D"color: #660;" class=3D=
"styled-by-prettify">(</span></span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">x</span><span style=3D"color: rgb(102, 102, 0);"><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">),</span></span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> sin</span><span style=3D=
"color: rgb(102, 102, 0);"><span style=3D"color: #660;" class=3D"styled-by-=
prettify">(</span></span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">x</span><span style=3D"color: rgb(102, 102, 0);"><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">)};</span></span></font><span style=
=3D"color: rgb(0, 0, 0);"><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br></span></span><span style=3D"color: rgb(102, 102, 0);"><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br></span></span><span style=3D"=
color: rgb(0, 0, 0);"><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">tuple t </span></span><span style=3D"color: rgb(102, 102, 0);"><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">=3D</span></span><span s=
tyle=3D"color: rgb(0, 0, 0);"><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span></span><span style=3D"color: rgb(102, 0, 102);"><span =
style=3D"color: #606;" class=3D"styled-by-prettify">GetAngleVector</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">tuple</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">double</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">double</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">&gt;&gt;</span></span><span style=3D"color: rgb(102, 102, 0)=
;"><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span></span=
><span style=3D"color: rgb(0, 102, 102);"><span style=3D"color: #066;" clas=
s=3D"styled-by-prettify">2.7</span></span><span style=3D"color: rgb(102, 10=
2, 0);"><span style=3D"color: #660;" class=3D"styled-by-prettify">);</span>=
</span><span style=3D"color: rgb(0, 0, 0);"><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br>pair p </span></span><span style=3D"color: r=
gb(102, 102, 0);"><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>=3D</span></span><span style=3D"color: rgb(0, 0, 0);"><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span></span><span style=3D"color: =
rgb(102, 0, 102);"><span style=3D"color: #606;" class=3D"styled-by-prettify=
">GetAngleVector</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
pair</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">double</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">double</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">&gt;&gt;</span></span><span style=3D"c=
olor: rgb(102, 102, 0);"><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">(</span></span><span style=3D"color: rgb(0, 102, 102);"><span style=
=3D"color: #066;" class=3D"styled-by-prettify">2.7</span></span><span style=
=3D"color: rgb(102, 102, 0);"><span style=3D"color: #660;" class=3D"styled-=
by-prettify">);</span></span><span style=3D"color: rgb(0, 0, 0);"><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br>array</span></span><sp=
an style=3D"color: rgb(102, 102, 0);"><span style=3D"color: #660;" class=3D=
"styled-by-prettify">&lt;</span></span><span style=3D"color: rgb(0, 0, 136)=
;"><span style=3D"color: #008;" class=3D"styled-by-prettify">double</span><=
/span><span style=3D"color: rgb(102, 102, 0);"><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">,</span></span><span style=3D"color: rgb(0, 0=
, 0);"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span></=
span><span style=3D"color: rgb(0, 102, 102);"><span style=3D"color: #066;" =
class=3D"styled-by-prettify">2</span></span><span style=3D"color: rgb(102, =
102, 0);"><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</s=
pan></span><font color=3D"#000000"><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> arr </span><span style=3D"color: rgb(102, 102, 0);"><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span></span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: rgb(102, 0, 102);"><span style=3D"color: #606;" class=3D"styled-=
by-prettify">GetAngleVector</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify">array</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
double</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
 style=3D"color: #066;" class=3D"styled-by-prettify">2</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">&gt;&gt;</span></span><span sty=
le=3D"color: rgb(102, 102, 0);"><span style=3D"color: #660;" class=3D"style=
d-by-prettify">(</span></span><span style=3D"color: rgb(0, 102, 102);"><spa=
n style=3D"color: #066;" class=3D"styled-by-prettify">2.7</span></span><spa=
n style=3D"color: rgb(102, 102, 0);"><span style=3D"color: #660;" class=3D"=
styled-by-prettify">);</span></span></font><span style=3D"color: rgb(102, 1=
02, 0);"><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></sp=
an></span></div></code></div><div><br></div>However<b> allowing for reverse=
d structured binding to would mean that the compiler would only have to com=
pile one function, rather than multiple separate functions that differed on=
ly in their return type.=C2=A0</b><br>In addition, the structured binding s=
yntax makes it more obvious what exactly&#39;s happening. Finally, a struct=
ured binding can be directly assigned to another structured binding, so</di=
v><div><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, =
250); border-color: rgb(187, 187, 187); border-style: solid; border-width: =
1px; word-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subp=
rettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">auto<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an 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=
: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify">y</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=
">=3D</span><font color=3D"#000000"><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">[</span><span style=3D"color: #066;" class=3D"styled-by-prettify"=
>3</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span>=
<span style=3D"color: #066;" class=3D"styled-by-prettify">4.7</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">];</span></font></div></=
code></div>WOULD BE valid, whereas</div><div><div class=3D"prettyprint" sty=
le=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187=
); border-style: solid; border-width: 1px; word-wrap: break-word;"><code cl=
ass=3D"prettyprint"><div class=3D"subprettyprint"><font color=3D"#660066"><=
span style=3D"color: #008;" class=3D"styled-by-prettify">auto</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">[</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">x</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">y</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">]</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</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=
: #066;" class=3D"styled-by-prettify">3</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">,</span><span style=3D"color: #066;" class=3D"=
styled-by-prettify">4.7</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">};</span><span style=3D"color: #800;" class=3D"styled-by-prett=
ify">//Currently causes error</span></font></div></code></div>Would cause a=
n error (as it currently does).=C2=A0<br><br><br>On Monday, May 15, 2017 at=
 4:37:50 AM UTC-6, Ville Voutilainen wrote:<blockquote class=3D"gmail_quote=
" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding=
-left: 1ex;">On 15 May 2017 at 12:49, Antonio Perez &lt;<a href=3D"javascri=
pt:" target=3D"_blank" gdf-obfuscated-mailto=3D"IlzX06S-CQAJ" rel=3D"nofoll=
ow" onmousedown=3D"this.href=3D&#39;javascript:&#39;;return true;" onclick=
=3D"this.href=3D&#39;javascript:&#39;;return true;">ant...@perezexcelsior.c=
om</a>&gt; wrote:
<br>&gt; Structured binding is an extremely useful concept because it allow=
s the
<br>&gt; efficent and intuitive unpacking of data-structures into their ind=
ividual
<br>&gt; values, and it works on a wide range of data structures. Not only =
does it
<br>&gt; work on tuples and pairs, but it also works on structs defined by =
the
<br>&gt; programmer without any additional effort on their part. I propose =
making
<br>&gt; this language feature more complete by allowing structured binding=
 to take
<br>&gt; place in reverse:
<br>&gt;
<br>&gt; tuple a =3D {1, 3.7}; //Creates a tuple of type tuple&lt;int, doub=
le&gt; with values
<br>&gt; 1 and 3.7
<br>&gt; tuple b =3D [1, 3.7]; //Ditto
<br>&gt;
<br>&gt; =C2=A0Where is this useful?
<br>&gt; The above example isn&#39;t particularly useful, HOWEVER here&#39;=
s a more real
<br>&gt; usage case:
<br>&gt;
<br>&gt; [double, double] GetAngleVector(double x)
<br>&gt; {
<br>&gt; =C2=A0 =C2=A0 return [cos(x), sin(x)];
<br>&gt; }
<br>&gt;
<br>&gt; //All of these would be 100% valid:
<br>&gt; tuple t =3D GetAngleVector(2.7);
<br>&gt; pair p =3D GetAngleVector(2.7);
<br>&gt; array&lt;double, 2&gt; arr =3D GetAngleVector(2.7);
<br>&gt; auto [x,y] =3D GetAngleVector(2.7);
<br>
<br>
<br>Interesting. The way I looked at that idea was like this: &quot;we want=
 to
<br>make it easy to allow
<br>initializing an object from an object of tuple-like type if the first
<br>object can be initialized with a structured binding
<br>decomposition of that tuple-like type&quot;. More concretely,
<br>1) overload-resolve the initialization as usual
<br>2) if that fails, try the structured binding approach
<br>
<br>Semi-obvious questions:
<br>a) can we just do it as a language feature like that..
<br>b) ..or should it be an &quot;opt-in&quot;?
<br>c) how does it interact with class template argument deduction?
<br>Probably quite well, because
<br>pair p =3D GetAngleVector(2.9);
<br>isn&#39;t valid, so the fallback mechanism would eventually kick in, do
<br>structured bindings for the source
<br>and deduce pair&lt;int, double&gt;.
<br></blockquote></div></div></div>

<p></p>

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

------=_Part_1344_1019129708.1494848728980--

------=_Part_1343_1125434871.1494848728979--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Mon, 15 May 2017 14:50:41 +0300
Raw View
On 15 May 2017 at 14:45, Antonio Perez <antonio@perezexcelsior.com> wrote:
> Oh! It would interact with normal template argument deduction very nicely.
> In most cases, the [] brackets could just be replaced with curly braces:
>
> pair p = [2,"Hello world"];
> array<double, 3> arr = [3.7, 9.2, 8.1];
> Would be equivalent to:
> pair p = {2, "Hello world"};
> array<double, 3> arr = {3.7, 9.2, 8.1};
>
> Correspondingly,
> [double, double] GetAngleVector(double x)
> {
>     return [cos(x), sin(x)];
> }
> tuple t = GetAngleVector(2.7);
> pair p = GetAngleVector(2.7);
> array<double, 2> arr = GetAngleVector(2.7);
> Would be equivalent to:
> template<class T> T GetAngleVector(double x)
> {
>     return T{cos(x), sin(x)};
> }
> tuple t = GetAngleVector<tuple<double, double>>(2.7);
> pair p = GetAngleVector<pair<double, double>>(2.7);
> array<double, 2> arr = GetAngleVector<array<double, 2>>(2.7);
>
> However allowing for reversed structured binding to would mean that the
> compiler would only have to compile one function, rather than multiple
> separate functions that differed only in their return type.

Huh? You mean that the compiler would use some magic internal type?
The thing I mentioned,
meaning trying structured binding if the initialization isn't
otherwise valid, would mean that
your GetAngleVector would return a tuple. Then we wouldn't need to add
a constructor for
pair, since initializing pair from tuple would fail, and then we try
via structured bindings,
which would then work. No multiple separate functions, just a new way
to convert.

> In addition, the structured binding syntax makes it more obvious what
> exactly's happening. Finally, a structured binding can be directly assigned
> to another structured binding, so
> auto [x,y] = [3,4.7];
> WOULD BE valid, whereas
> auto [x,y] = {3,4.7};//Currently causes error
> Would cause an error (as it currently does).


Well, that approach would seem to introduce a new language-internal type.

--
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/CAFk2RUYfo%3Dn4Mr9CTJYnHVDvvutiKWfn7oBk5qik9%3DGOfspY3g%40mail.gmail.com.

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Mon, 15 May 2017 08:56:03 -0700
Raw View
On segunda-feira, 15 de maio de 2017 04:45:28 PDT Antonio Perez wrote:
> pair p = [2,"Hello world"];
> array<double, 3> arr = [3.7, 9.2, 8.1];
> Would be equivalent to:
> pair p = {2, "Hello world"};
> array<double, 3> arr = {3.7, 9.2, 8.1};

So why do we need another syntax?

--
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/2437301.KMujuqxaIp%40tjmaciei-mobl1.

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Mon, 15 May 2017 19:02:17 +0300
Raw View
On 15 May 2017 at 18:56, Thiago Macieira <thiago@macieira.org> wrote:
> On segunda-feira, 15 de maio de 2017 04:45:28 PDT Antonio Perez wrote:
>> pair p = [2,"Hello world"];
>> array<double, 3> arr = [3.7, 9.2, 8.1];
>> Would be equivalent to:
>> pair p = {2, "Hello world"};
>> array<double, 3> arr = {3.7, 9.2, 8.1};
>
> So why do we need another syntax?


Because a new language facility can convert tuples to pairs, pairs to
arrays, tuples to arrays,
arrays to pairs, arrays to tuples and more without those types
defining conversions between
each other.

--
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/CAFk2RUa0U0bzeBAimrRYG53ec3xnn5z0Dv4Ka%3D83UGK775K%3Duw%40mail.gmail.com.

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Mon, 15 May 2017 10:53:57 -0700
Raw View
On segunda-feira, 15 de maio de 2017 09:02:17 PDT Ville Voutilainen wrote:
> On 15 May 2017 at 18:56, Thiago Macieira <thiago@macieira.org> wrote:
> > On segunda-feira, 15 de maio de 2017 04:45:28 PDT Antonio Perez wrote:
> >> pair p = [2,"Hello world"];
> >> array<double, 3> arr = [3.7, 9.2, 8.1];
> >> Would be equivalent to:
> >> pair p = {2, "Hello world"};
> >> array<double, 3> arr = {3.7, 9.2, 8.1};
> >
> > So why do we need another syntax?
>
> Because a new language facility can convert tuples to pairs, pairs to
> arrays, tuples to arrays,
> arrays to pairs, arrays to tuples and more without those types
> defining conversions between
> each other.

None of that explains why we need the new syntax. Converting from pair to
tuple and vice-versa is a simple library problem, as is converting from arrays
to either. Converting from a homogeneous tuple to an array or an
initializer_list could be a new language feature.

But why do we need square brackets for this?

--
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/27181982.ffUKZiTz5M%40tjmaciei-mobl1.

.


Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Mon, 15 May 2017 19:58:52 +0200
Raw View
This is a multi-part message in MIME format.
--------------F75FD13511410AA76B7C9A38
Content-Type: text/plain; charset="UTF-8"; format=flowed
Content-Transfer-Encoding: quoted-printable

Le 15/05/2017 =C3=A0 11:49, Antonio Perez a =C3=A9crit :
> Structured binding is an extremely useful concept because it allows=20
> the efficent and intuitive unpacking of data-structures into their=20
> individual values, and it works on a wide range of data structures.=20
> Not only does it work on tuples and pairs, but it also works on=20
> structs defined by the programmer without any additional effort on=20
> their part. I propose making this language feature more complete by=20
> allowing structured binding to take place in reverse:
>
> |
> tuple a =3D{1,3.7};//Creates a tuple of type tuple<int, double> with=20
> values 1 and 3.7
> tuple b =3D[1,3.7];//Ditto
> |
>
> *Where is this useful?*
> The above example isn't particularly useful, HOWEVER here's a more=20
> real usage case:
>
> |
> [double,double]GetAngleVector(doublex)
> {
> return[cos(x),sin(x)];
> }
>
> //All of these would be 100% valid:
> tuple t =3DGetAngleVector(2.7);
> pair p =3DGetAngleVector(2.7);
> array<double,2>arr =3DGetAngleVector(2.7);
> auto[x,y]=3DGetAngleVector(2.7);
>
> structPoint2D{
> doublex,y;
> };
> Point2Dpoint =3DGetAngleVector(2.7);
> |
>
> Here, the function returns a structured-binding that will=20
> automatically map to whatever it's assigned to without issue.
>
>
> Something similar could be achieved in standard C++17, although it's=20
> unseemly and difficult to read:
> |
> tuple<double,double>GetAngleVector(doublex)
> {
> return{cos(x),sin(x)};
> }
>
> //All of these would be 100% valid:
> pair p=20
> =3Dstd::make_from_tuple<pair<double,double>,tuple<double,double>>(GetAngl=
eVector(2.7));
> array<double,2>arr=20
> =3Dstd::make_from_tuple<std::array<double,2>,tuple<double,double>>(GetAng=
leVector(2.7));
>
> structPoint2D{
> doublex,y;
> };
> Point2Dpoint=20
> =3Dstd::make_from_tuple<Point2D,tuple<double,double>>(GetAngleVector(2.7)=
)
> |
>
>

Hi,

have you take a look at=20
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0341r0.html?

p0341r0 allows in addition named elements.

<string topSong, person president, double avgTemp>=20
someFactsAboutYear(int year) {
   if(year=3D=3D1962)
     return {"Stranger On The Shore", Presidents.get("Kennedy"), 14};
}

Vicente

--=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/a93eebc3-b699-34a8-b3f7-cac4335f1154%40wanadoo.f=
r.

--------------F75FD13511410AA76B7C9A38
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<html>
  <head>
    <meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
  </head>
  <body bgcolor=3D"#FFFFFF" text=3D"#000000">
    <div class=3D"moz-cite-prefix">Le 15/05/2017 =C3=A0 11:49, Antonio Pere=
z a
      =C3=A9crit=C2=A0:<br>
    </div>
    <blockquote
      cite=3D"mid:db270137-954e-4883-904c-0a3eb378b8c3@isocpp.org"
      type=3D"cite">
      <div dir=3D"ltr">Structured binding is an extremely useful concept
        because it allows the efficent and intuitive unpacking of
        data-structures into their individual values, and it works on a
        wide range of data structures. Not only does it work on tuples
        and pairs, but it also works on structs defined by the
        programmer without any additional effort on their part. I
        propose making this language feature more complete by allowing
        structured binding to take place in reverse:
        <div><br>
        </div>
        <div>
          <div class=3D"prettyprint" style=3D"background-color: rgb(250,
            250, 250); border-color: rgb(187, 187, 187); border-style:
            solid; border-width: 1px; word-wrap: break-word;"><code
              class=3D"prettyprint">
              <div class=3D"subprettyprint"><span style=3D"color: #000;"
                  class=3D"styled-by-prettify">tuple a </span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">=3D</=
span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">{</sp=
an><span
                  style=3D"color: #066;" class=3D"styled-by-prettify">1</sp=
an><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #066;" class=3D"styled-by-prettify">3.7</=
span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">};</s=
pan><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #800;" class=3D"styled-by-prettify">//Cre=
ates
                  a tuple of type tuple&lt;int, double&gt; with values 1
                  and 3.7</span><span style=3D"color: #000;"
                  class=3D"styled-by-prettify"><br>
                  tuple b </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: #660;" class=3D"styled-by-prettify">[</sp=
an><span
                  style=3D"color: #066;" class=3D"styled-by-prettify">1</sp=
an><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #066;" class=3D"styled-by-prettify">3.7</=
span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">];</s=
pan><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #800;" class=3D"styled-by-prettify">//Dit=
to</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                </span></div>
            </code></div>
          <br>
          =C2=A0<b>Where is this useful?</b></div>
        <div>The above example isn't particularly useful, HOWEVER here's
          a more real usage case:</div>
        <div><br>
        </div>
        <div>
          <div class=3D"prettyprint" style=3D"background-color: rgb(250,
            250, 250); border-color: rgb(187, 187, 187); border-style:
            solid; border-width: 1px; word-wrap: break-word;"><code
              class=3D"prettyprint">
              <div class=3D"subprettyprint"><span style=3D"color: #660;"
                  class=3D"styled-by-prettify">[</span><span style=3D"color=
:
                  #008;" class=3D"styled-by-prettify">double</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">]</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #606;" class=3D"styled-by-prettify">GetAn=
gleVector</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> x</s=
pan><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">)</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                </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">return</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">[</sp=
an><font
                  color=3D"#000000"><span style=3D"color: #000;"
                    class=3D"styled-by-prettify">cos</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: #660;" class=3D"styled-by-prettify">),<=
/span><span
                    style=3D"color: #000;" class=3D"styled-by-prettify"> si=
n</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: #660;" class=3D"styled-by-prettify">)];=
</span></font><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                </span><span style=3D"color: #660;"
                  class=3D"styled-by-prettify">}</span><span style=3D"color=
:
                  #000;" class=3D"styled-by-prettify"><br>
                  <br>
                </span><span style=3D"color: #800;"
                  class=3D"styled-by-prettify">//All of these would be
                  100% valid:</span><span style=3D"color: #000;"
                  class=3D"styled-by-prettify"><br>
                  tuple t </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: #606;" class=3D"styled-by-prettify">GetAn=
gleVector</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span
                  style=3D"color: #066;" class=3D"styled-by-prettify">2.7</=
span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">);</s=
pan><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                  pair p </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: #606;" class=3D"styled-by-prettify">GetAn=
gleVector</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span
                  style=3D"color: #066;" class=3D"styled-by-prettify">2.7</=
span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">);</s=
pan><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                  array</span><span style=3D"color: #660;"
                  class=3D"styled-by-prettify">&lt;</span><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #066;" class=3D"styled-by-prettify">2</sp=
an><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&gt;<=
/span><font
                  color=3D"#000000"><span style=3D"color: #000;"
                    class=3D"styled-by-prettify"> arr </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: #606;" class=3D"styled-by-prettify">Get=
AngleVector</span><span
                    style=3D"color: #660;" class=3D"styled-by-prettify">(</=
span><span
                    style=3D"color: #066;" class=3D"styled-by-prettify">2.7=
</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: #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">x</=
span><span
                    style=3D"color: #660;" class=3D"styled-by-prettify">,</=
span><span
                    style=3D"color: #000;" class=3D"styled-by-prettify">y</=
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">=3D=
</span><span
                    style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span
                    style=3D"color: #606;" class=3D"styled-by-prettify">Get=
AngleVector</span><span
                    style=3D"color: #660;" class=3D"styled-by-prettify">(</=
span><span
                    style=3D"color: #066;" class=3D"styled-by-prettify">2.7=
</span><span
                    style=3D"color: #660;" class=3D"styled-by-prettify">);<=
/span><span
                    style=3D"color: #000;" class=3D"styled-by-prettify"><br=
>
                    <br>
                  </span><span style=3D"color: #008;"
                    class=3D"styled-by-prettify">struct</span><span
                    style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span
                    style=3D"color: #606;" class=3D"styled-by-prettify">Poi=
nt2D</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"><br=
>
                    =C2=A0 =C2=A0 </span><span style=3D"color: #008;"
                    class=3D"styled-by-prettify">double</span><span
                    style=3D"color: #000;" class=3D"styled-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">y</=
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">};</span><span
                    style=3D"color: #000;" class=3D"styled-by-prettify"><br=
>
                  </span><span style=3D"color: #606;"
                    class=3D"styled-by-prettify">Point2D</span><span
                    style=3D"color: #000;" class=3D"styled-by-prettify">
                    point </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: #606;" class=3D"styled-by-prettify">Get=
AngleVector</span><span
                    style=3D"color: #660;" class=3D"styled-by-prettify">(</=
span><span
                    style=3D"color: #066;" class=3D"styled-by-prettify">2.7=
</span><span
                    style=3D"color: #660;" class=3D"styled-by-prettify">);<=
/span></font></div>
            </code></div>
          <br>
          Here, the function returns a structured-binding that will
          automatically map to whatever it's assigned to without issue.=C2=
=A0</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>Something similar could be achieved in standard C++17,
          although it's unseemly and difficult to read:</div>
        <div>
          <div class=3D"prettyprint" style=3D"background-color: rgb(250,
            250, 250); border-color: rgb(187, 187, 187); border-style:
            solid; border-width: 1px; word-wrap: break-word;"><code
              class=3D"prettyprint">
              <div class=3D"subprettyprint"><span style=3D"color: #000;"
                  class=3D"styled-by-prettify">tuple</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&lt;<=
/span><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&gt;<=
/span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #606;" class=3D"styled-by-prettify">GetAn=
gleVector</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> x</s=
pan><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">)</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                </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">return</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><font
                  color=3D"#666600"><span style=3D"color: #660;"
                    class=3D"styled-by-prettify">{</span></font><font
                  color=3D"#000000"><span style=3D"color: #000;"
                    class=3D"styled-by-prettify">cos</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: #660;" class=3D"styled-by-prettify">),<=
/span><span
                    style=3D"color: #000;" class=3D"styled-by-prettify"> si=
n</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: #660;" class=3D"styled-by-prettify">)};=
</span></font><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                </span><span style=3D"color: #660;"
                  class=3D"styled-by-prettify">}</span><span style=3D"color=
:
                  #000;" class=3D"styled-by-prettify"><br>
                  <br>
                </span><span style=3D"color: #800;"
                  class=3D"styled-by-prettify">//All of these would be
                  100% valid:</span><span style=3D"color: #000;"
                  class=3D"styled-by-prettify"><br>
                  pair p </span><span style=3D"color: #660;"
                  class=3D"styled-by-prettify">=3D</span><span style=3D"col=
or:
                  #000;" class=3D"styled-by-prettify"> std</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">::</s=
pan><span
                  style=3D"color: #000;" class=3D"styled-by-prettify">make_=
from_tuple</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&lt;<=
/span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify">pair<=
/span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&lt;<=
/span><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&gt;,=
</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> tupl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&lt;<=
/span><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&gt;&=
gt;(</span><span
                  style=3D"color: #606;" class=3D"styled-by-prettify">GetAn=
gleVector</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span
                  style=3D"color: #066;" class=3D"styled-by-prettify">2.7</=
span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">));</=
span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                  array</span><span style=3D"color: #660;"
                  class=3D"styled-by-prettify">&lt;</span><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #066;" class=3D"styled-by-prettify">2</sp=
an><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&gt;<=
/span><font
                  color=3D"#000000"><span style=3D"color: #000;"
                    class=3D"styled-by-prettify"> arr </span><span
                    style=3D"color: #660;" class=3D"styled-by-prettify">=3D=
</span><span
                    style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span></font><span
                  style=3D"color: #000;" class=3D"styled-by-prettify">std</=
span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">::</s=
pan><span
                  style=3D"color: #000;" class=3D"styled-by-prettify">make_=
from_tuple</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&lt;<=
/span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify">std</=
span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">::</s=
pan><span
                  style=3D"color: #000;" class=3D"styled-by-prettify">array=
</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&lt;<=
/span><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #066;" class=3D"styled-by-prettify">2</sp=
an><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&gt;,=
</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> tupl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&lt;<=
/span><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&gt;&=
gt;(</span><span
                  style=3D"color: #606;" class=3D"styled-by-prettify">GetAn=
gleVector</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span
                  style=3D"color: #066;" class=3D"styled-by-prettify">2.7</=
span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">));</=
span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                </span><font color=3D"#000000"><span style=3D"color: #000;"
                    class=3D"styled-by-prettify"><br>
                  </span><span style=3D"color: #008;"
                    class=3D"styled-by-prettify">struct</span><span
                    style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span
                    style=3D"color: #606;" class=3D"styled-by-prettify">Poi=
nt2D</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"><br=
>
                    =C2=A0 =C2=A0 </span><span style=3D"color: #008;"
                    class=3D"styled-by-prettify">double</span><span
                    style=3D"color: #000;" class=3D"styled-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">y</=
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">};</span><span
                    style=3D"color: #000;" class=3D"styled-by-prettify"><br=
>
                  </span><span style=3D"color: #606;"
                    class=3D"styled-by-prettify">Point2D</span><span
                    style=3D"color: #000;" class=3D"styled-by-prettify">
                    point </span><span style=3D"color: #660;"
                    class=3D"styled-by-prettify">=3D</span><span
                    style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span></font><span
                  style=3D"color: #000;" class=3D"styled-by-prettify">std</=
span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">::</s=
pan><span
                  style=3D"color: #000;" class=3D"styled-by-prettify">make_=
from_tuple</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&lt;<=
/span><font
                  color=3D"#000000"><span style=3D"color: #606;"
                    class=3D"styled-by-prettify">Point2D</span></font><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> tupl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&lt;<=
/span><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&gt;&=
gt;(</span><span
                  style=3D"color: #606;" class=3D"styled-by-prettify">GetAn=
gleVector</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span
                  style=3D"color: #066;" class=3D"styled-by-prettify">2.7</=
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>
          <br>
        </div>
      </div>
    </blockquote>
    <br>
    Hi,<br>
    <br>
    have you take a look at
    <a class=3D"moz-txt-link-freetext" href=3D"http://www.open-std.org/jtc1=
/sc22/wg21/docs/papers/2016/p0341r0.html">http://www.open-std.org/jtc1/sc22=
/wg21/docs/papers/2016/p0341r0.html</a>?<br>
    <br>
    p0341r0 allows in addition named elements.<br>
    <br>
    <meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf-8=
">
    &lt;string topSong, person president, double avgTemp&gt;
    someFactsAboutYear(int year) {<br>
    =C2=A0 if(year=3D=3D1962)<br>
    =C2=A0=C2=A0=C2=A0 return {"Stranger On The Shore", Presidents.get("Ken=
nedy"), 14};<br>
    }<br>
    <br>
    Vicente<br>
    <br>
  </body>
</html>

<p></p>

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

--------------F75FD13511410AA76B7C9A38--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Mon, 15 May 2017 21:07:45 +0300
Raw View
On 15 May 2017 at 20:53, Thiago Macieira <thiago@macieira.org> wrote:
> On segunda-feira, 15 de maio de 2017 09:02:17 PDT Ville Voutilainen wrote:
>> On 15 May 2017 at 18:56, Thiago Macieira <thiago@macieira.org> wrote:
>> > On segunda-feira, 15 de maio de 2017 04:45:28 PDT Antonio Perez wrote:
>> >> pair p = [2,"Hello world"];
>> >> array<double, 3> arr = [3.7, 9.2, 8.1];
>> >> Would be equivalent to:
>> >> pair p = {2, "Hello world"};
>> >> array<double, 3> arr = {3.7, 9.2, 8.1};
>> >
>> > So why do we need another syntax?
>>
>> Because a new language facility can convert tuples to pairs, pairs to
>> arrays, tuples to arrays,
>> arrays to pairs, arrays to tuples and more without those types
>> defining conversions between
>> each other.
>
> None of that explains why we need the new syntax. Converting from pair to

It might not need new syntax. That remains to be seen. If there's no
new syntax in it,
that means that existing syntaxes grow new capabilities.

> tuple and vice-versa is a simple library problem, as is converting from arrays
> to either. Converting from a homogeneous tuple to an array or an

It doesn't seem to be such a simple problem, considering that the
current library can't do
it and doing it for permutations of multiple types doesn't scale.

--
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/CAFk2RUZDtZD%2BvOQNwpgc8_F10B7X56AR%2BTX4G1MhOmpP_K0AcA%40mail.gmail.com.

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Mon, 15 May 2017 11:32:43 -0700
Raw View
On segunda-feira, 15 de maio de 2017 11:07:45 PDT Ville Voutilainen wrote:
> On 15 May 2017 at 20:53, Thiago Macieira <thiago@macieira.org> wrote:
> > On segunda-feira, 15 de maio de 2017 09:02:17 PDT Ville Voutilainen wrote:
> >> On 15 May 2017 at 18:56, Thiago Macieira <thiago@macieira.org> wrote:
> >> > On segunda-feira, 15 de maio de 2017 04:45:28 PDT Antonio Perez wrote:
> >> >> pair p = [2,"Hello world"];
> >> >> array<double, 3> arr = [3.7, 9.2, 8.1];
> >> >> Would be equivalent to:
> >> >> pair p = {2, "Hello world"};
> >> >> array<double, 3> arr = {3.7, 9.2, 8.1};
> >> >
> >> > So why do we need another syntax?
> >>
> >> Because a new language facility can convert tuples to pairs, pairs to
> >> arrays, tuples to arrays,
> >> arrays to pairs, arrays to tuples and more without those types
> >> defining conversions between
> >> each other.
> >
> > None of that explains why we need the new syntax. Converting from pair to
>
> It might not need new syntax. That remains to be seen. If there's no
> new syntax in it,
> that means that existing syntaxes grow new capabilities.

That's my point. I don't see any new capability above, hence no need for any
new syntax. The new features you discussed are about variables already
initialised.

> > tuple and vice-versa is a simple library problem, as is converting from
> > arrays to either. Converting from a homogeneous tuple to an array or an
>
> It doesn't seem to be such a simple problem, considering that the
> current library can't do
> it and doing it for permutations of multiple types doesn't scale.

Sorry, I didn't follow this.

It should be trivial to add a constructor to std::pair that takes std::tuple
with the same parameters. It should be easy to add a std::tuple constructor
that takes std::pair of the same types (provided there are exactly two of
them).

The new language feature would be to initialise an aggregate with std::tuple
and vice-versa. Given that structured bindings offers std::tuple_size and
such, we need a language feature that returns the number of elements in that
aggregate, their types and allows access to the values in a given object. We
could even call this feature "reflection".

--
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/5518650.gX4jCCyuLa%40tjmaciei-mobl1.

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Mon, 15 May 2017 22:13:16 +0300
Raw View
On 15 May 2017 at 21:32, Thiago Macieira <thiago@macieira.org> wrote:
>> > tuple and vice-versa is a simple library problem, as is converting from
>> > arrays to either. Converting from a homogeneous tuple to an array or an
>>
>> It doesn't seem to be such a simple problem, considering that the
>> current library can't do
>> it and doing it for permutations of multiple types doesn't scale.
>
> Sorry, I didn't follow this.
>
> It should be trivial to add a constructor to std::pair that takes std::tuple
> with the same parameters. It should be easy to add a std::tuple constructor

Good luck with that trivial exercise. Now, do it again and add a
constructor to std::pair
that takes an array. Repeat the exercise for tuple. And array. Now go
add such things
to optional and variant while you're at it.

Once you've tried, you may come away thinking that perhaps a language extension
would work better.

> The new language feature would be to initialise an aggregate with std::tuple
> and vice-versa. Given that structured bindings offers std::tuple_size and
> such, we need a language feature that returns the number of elements in that
> aggregate, their types and allows access to the values in a given object. We
> could even call this feature "reflection".

Mere reflection doesn't make it work for all cases. So we need
something more uniform than that.

--
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/CAFk2RUbBgzVNMZy4c%3D88k%3DYXVPdUVvqxLGayhjomYt0Rv-gqfg%40mail.gmail.com.

.


Author: HarD Gamer <rodrigojose690@gmail.com>
Date: Mon, 15 May 2017 13:27:17 -0700 (PDT)
Raw View
------=_Part_1579_815398046.1494880037676
Content-Type: multipart/alternative;
 boundary="----=_Part_1580_576080840.1494880037676"

------=_Part_1580_576080840.1494880037676
Content-Type: text/plain; charset="UTF-8"

https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/xdz8o06M9Fk

Em segunda-feira, 15 de maio de 2017 06:49:18 UTC-3, Antonio Perez escreveu:
>
> Structured binding is an extremely useful concept because it allows the
> efficent and intuitive unpacking of data-structures into their individual
> values, and it works on a wide range of data structures. Not only does it
> work on tuples and pairs, but it also works on structs defined by the
> programmer without any additional effort on their part. I propose making
> this language feature more complete by allowing structured binding to take
> place in reverse:
>
> tuple a = {1, 3.7}; //Creates a tuple of type tuple<int, double> with
> values 1 and 3.7
> tuple b = [1, 3.7]; //Ditto
>
>  *Where is this useful?*
> The above example isn't particularly useful, HOWEVER here's a more real
> usage case:
>
> [double, double] GetAngleVector(double x)
> {
>     return [cos(x), sin(x)];
> }
>
> //All of these would be 100% valid:
> tuple t = GetAngleVector(2.7);
> pair p = GetAngleVector(2.7);
> array<double, 2> arr = GetAngleVector(2.7);
> auto [x,y] = GetAngleVector(2.7);
>
> struct Point2D {
>     double x,y;
> };
> Point2D point = GetAngleVector(2.7);
>
> Here, the function returns a structured-binding that will automatically
> map to whatever it's assigned to without issue.
>
>
> Something similar could be achieved in standard C++17, although it's
> unseemly and difficult to read:
> tuple<double, double> GetAngleVector(double x)
> {
>     return {cos(x), sin(x)};
> }
>
> //All of these would be 100% valid:
> pair p = std::make_from_tuple<pair<double, double>, tuple<double,double>>(
> GetAngleVector(2.7));
> array<double, 2> arr = std::make_from_tuple<std::array<double, 2>, tuple<
> double,double>>(GetAngleVector(2.7));
>
> struct Point2D {
>     double x,y;
> };
> Point2D point = std::make_from_tuple<Point2D, tuple<double,double>>(
> GetAngleVector(2.7))
>
>
>

--
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/f9b48628-03b3-4ae0-ac76-88839359dbc5%40isocpp.org.

------=_Part_1580_576080840.1494880037676
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">https://groups.google.com/a/isocpp.org/forum/#!topic/std-p=
roposals/xdz8o06M9Fk<br><br>Em segunda-feira, 15 de maio de 2017 06:49:18 U=
TC-3, Antonio Perez  escreveu:<blockquote class=3D"gmail_quote" style=3D"ma=
rgin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">=
<div dir=3D"ltr">Structured binding is an extremely useful concept because =
it allows the efficent and intuitive unpacking of data-structures into thei=
r individual values, and it works on a wide range of data structures. Not o=
nly does it work on tuples and pairs, but it also works on structs defined =
by the programmer without any additional effort on their part. I propose ma=
king this language feature more complete by allowing structured binding to =
take place in reverse:<div><br></div><div><div style=3D"background-color:rg=
b(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-widt=
h:1px;word-wrap:break-word"><code><div><span style=3D"color:#000">tuple a <=
/span><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> </sp=
an><span style=3D"color:#660">{</span><span style=3D"color:#066">1</span><s=
pan style=3D"color:#660">,</span><span style=3D"color:#000"> </span><span s=
tyle=3D"color:#066">3.7</span><span style=3D"color:#660">};</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#800">//Creates a tuple of t=
ype tuple&lt;int, double&gt; with values 1 and 3.7</span><span style=3D"col=
or:#000"><br>tuple b </span><span style=3D"color:#660">=3D</span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#660">[</span><span style=3D"=
color:#066">1</span><span style=3D"color:#660">,</span><span style=3D"color=
:#000"> </span><span style=3D"color:#066">3.7</span><span style=3D"color:#6=
60">];</span><span style=3D"color:#000"> </span><span style=3D"color:#800">=
//Ditto</span><span style=3D"color:#000"><br></span></div></code></div><br>=
=C2=A0<b>Where is this useful?</b></div><div>The above example isn&#39;t pa=
rticularly useful, HOWEVER here&#39;s a more real usage case:</div><div><br=
></div><div><div style=3D"background-color:rgb(250,250,250);border-color:rg=
b(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><c=
ode><div><span style=3D"color:#660">[</span><span style=3D"color:#008">doub=
le</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#008">double</span><span style=3D"color:#660">]</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#606">GetAngleV=
ector</span><span style=3D"color:#660">(</span><span style=3D"color:#008">d=
ouble</span><span style=3D"color:#000"> x</span><span style=3D"color:#660">=
)</span><span style=3D"color:#000"><br></span><span style=3D"color:#660">{<=
/span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"co=
lor:#008">return</span><span style=3D"color:#000"> </span><span style=3D"co=
lor:#660">[</span><font color=3D"#000000"><span style=3D"color:#000">cos</s=
pan><span style=3D"color:#660">(</span><span style=3D"color:#000">x</span><=
span style=3D"color:#660">),</span><span style=3D"color:#000"> sin</span><s=
pan style=3D"color:#660">(</span><span style=3D"color:#000">x</span><span s=
tyle=3D"color:#660">)];</span></font><span style=3D"color:#000"><br></span>=
<span style=3D"color:#660">}</span><span style=3D"color:#000"><br><br></spa=
n><span style=3D"color:#800">//All of these would be 100% valid:</span><spa=
n style=3D"color:#000"><br>tuple t </span><span style=3D"color:#660">=3D</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#606">GetAngleV=
ector</span><span style=3D"color:#660">(</span><span style=3D"color:#066">2=
..7</span><span style=3D"color:#660">);</span><span style=3D"color:#000"><br=
>pair p </span><span style=3D"color:#660">=3D</span><span style=3D"color:#0=
00"> </span><span style=3D"color:#606">GetAngleVector</span><span style=3D"=
color:#660">(</span><span style=3D"color:#066">2.7</span><span style=3D"col=
or:#660">);</span><span style=3D"color:#000"><br>array</span><span style=3D=
"color:#660">&lt;</span><span style=3D"color:#008">double</span><span style=
=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#066">2</span><span style=3D"color:#660">&gt;</span><font color=3D"#00=
0000"><span style=3D"color:#000"> arr </span><span style=3D"color:#660">=3D=
</span><span style=3D"color:#000"> </span><span style=3D"color:#606">GetAng=
leVector</span><span style=3D"color:#660">(</span><span style=3D"color:#066=
">2.7</span><span style=3D"color:#660">);</span><span style=3D"color:#000">=
<br></span><span style=3D"color:#008">auto</span><span style=3D"color:#000"=
> </span><span style=3D"color:#660">[</span><span style=3D"color:#000">x</s=
pan><span style=3D"color:#660">,</span><span style=3D"color:#000">y</span><=
span style=3D"color:#660">]</span><span style=3D"color:#000"> </span><span =
style=3D"color:#660">=3D</span><span style=3D"color:#000"> </span><span sty=
le=3D"color:#606">GetAngleVector</span><span style=3D"color:#660">(</span><=
span style=3D"color:#066">2.7</span><span style=3D"color:#660">);</span><sp=
an style=3D"color:#000"><br><br></span><span style=3D"color:#008">struct</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#606">Point2D</=
span><span style=3D"color:#000"> </span><span style=3D"color:#660">{</span>=
<span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#0=
08">double</span><span style=3D"color:#000"> x</span><span style=3D"color:#=
660">,</span><span style=3D"color:#000">y</span><span style=3D"color:#660">=
;</span><span style=3D"color:#000"><br></span><span style=3D"color:#660">};=
</span><span style=3D"color:#000"><br></span><span style=3D"color:#606">Poi=
nt2D</span><span style=3D"color:#000"> point </span><span style=3D"color:#6=
60">=3D</span><span style=3D"color:#000"> </span><span style=3D"color:#606"=
>GetAngleVector</span><span style=3D"color:#660">(</span><span style=3D"col=
or:#066">2.7</span><span style=3D"color:#660">);</span></font></div></code>=
</div><br>Here, the function returns a structured-binding that will automat=
ically map to whatever it&#39;s assigned to without issue.=C2=A0</div><div>=
<br></div><div><br></div><div>Something similar could be achieved in standa=
rd C++17, although it&#39;s unseemly and difficult to read:</div><div><div =
style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);bo=
rder-style:solid;border-width:1px;word-wrap:break-word"><code><div><span st=
yle=3D"color:#000">tuple</span><span style=3D"color:#660">&lt;</span><span =
style=3D"color:#008">double</span><span style=3D"color:#660">,</span><span =
style=3D"color:#000"> </span><span style=3D"color:#008">double</span><span =
style=3D"color:#660">&gt;</span><span style=3D"color:#000"> </span><span st=
yle=3D"color:#606">GetAngleVector</span><span style=3D"color:#660">(</span>=
<span style=3D"color:#008">double</span><span style=3D"color:#000"> x</span=
><span style=3D"color:#660">)</span><span style=3D"color:#000"><br></span><=
span style=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=
=A0 </span><span style=3D"color:#008">return</span><span style=3D"color:#00=
0"> </span><font color=3D"#666600"><span style=3D"color:#660">{</span></fon=
t><font color=3D"#000000"><span style=3D"color:#000">cos</span><span style=
=3D"color:#660">(</span><span style=3D"color:#000">x</span><span style=3D"c=
olor:#660">),</span><span style=3D"color:#000"> sin</span><span style=3D"co=
lor:#660">(</span><span style=3D"color:#000">x</span><span style=3D"color:#=
660">)};</span></font><span style=3D"color:#000"><br></span><span style=3D"=
color:#660">}</span><span style=3D"color:#000"><br><br></span><span style=
=3D"color:#800">//All of these would be 100% valid:</span><span style=3D"co=
lor:#000"><br>pair p </span><span style=3D"color:#660">=3D</span><span styl=
e=3D"color:#000"> std</span><span style=3D"color:#660">::</span><span style=
=3D"color:#000">make_from_tuple</span><span style=3D"color:#660">&lt;</span=
><span style=3D"color:#000">pair</span><span style=3D"color:#660">&lt;</spa=
n><span style=3D"color:#008">doub<wbr>le</span><span style=3D"color:#660">,=
</span><span style=3D"color:#000"> </span><span style=3D"color:#008">double=
</span><span style=3D"color:#660">&gt;,</span><span style=3D"color:#000"> t=
uple</span><span style=3D"color:#660">&lt;</span><span style=3D"color:#008"=
>double</span><span style=3D"color:#660">,</span><span style=3D"color:#008"=
>double</span><span style=3D"color:#660">&gt;&gt;(</span><span style=3D"col=
or:#606">GetAngle<wbr>Vector</span><span style=3D"color:#660">(</span><span=
 style=3D"color:#066">2.7</span><span style=3D"color:#660">));</span><span =
style=3D"color:#000"><br>array</span><span style=3D"color:#660">&lt;</span>=
<span style=3D"color:#008">double</span><span style=3D"color:#660">,</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#066">2</span><span=
 style=3D"color:#660">&gt;</span><font color=3D"#000000"><span style=3D"col=
or:#000"> arr </span><span style=3D"color:#660">=3D</span><span style=3D"co=
lor:#000"> </span></font><span style=3D"color:#000">std</span><span style=
=3D"color:#660">::</span><span style=3D"color:#000">make_from_tuple</span><=
span style=3D"color:#660">&lt;</span><span style=3D"color:#000">std</span><=
span style=3D"color:#660">::</span><span style=3D"color:#000">arra<wbr>y</s=
pan><span style=3D"color:#660">&lt;</span><span style=3D"color:#008">double=
</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#066">2</span><span style=3D"color:#660">&gt;,</span=
><span style=3D"color:#000"> tuple</span><span style=3D"color:#660">&lt;</s=
pan><span style=3D"color:#008">double</span><span style=3D"color:#660">,</s=
pan><span style=3D"color:#008">double</span><span style=3D"color:#660">&gt;=
&gt;(</span><span style=3D"color:#606">GetAngle<wbr>Vector</span><span styl=
e=3D"color:#660">(</span><span style=3D"color:#066">2.7</span><span style=
=3D"color:#660">));</span><span style=3D"color:#000"><br></span><font color=
=3D"#000000"><span style=3D"color:#000"><br></span><span style=3D"color:#00=
8">struct</span><span style=3D"color:#000"> </span><span style=3D"color:#60=
6">Point2D</span><span style=3D"color:#000"> </span><span style=3D"color:#6=
60">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=
=3D"color:#008">double</span><span style=3D"color:#000"> x</span><span styl=
e=3D"color:#660">,</span><span style=3D"color:#000">y</span><span style=3D"=
color:#660">;</span><span style=3D"color:#000"><br></span><span style=3D"co=
lor:#660">};</span><span style=3D"color:#000"><br></span><span style=3D"col=
or:#606">Point2D</span><span style=3D"color:#000"> point </span><span style=
=3D"color:#660">=3D</span><span style=3D"color:#000"> </span></font><span s=
tyle=3D"color:#000">std</span><span style=3D"color:#660">::</span><span sty=
le=3D"color:#000">make_from_tuple</span><span style=3D"color:#660">&lt;</sp=
an><font color=3D"#000000"><span style=3D"color:#606">Point2D</span></font>=
<span style=3D"color:#660">,</span><span style=3D"color:#000"> tuple</span>=
<span style=3D"color:#660">&lt;</span><span style=3D"color:#008">double</sp=
an><span style=3D"color:#660">,</span><span style=3D"color:#008">double</sp=
an><span style=3D"color:#660">&gt;&gt;(</span><span style=3D"color:#606">Ge=
tAngle<wbr>Vector</span><span style=3D"color:#660">(</span><span style=3D"c=
olor:#066">2.7</span><span style=3D"color:#660">))</span><span style=3D"col=
or:#000"><br></span></div></code></div><br><br></div></div></blockquote></d=
iv>

<p></p>

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

------=_Part_1580_576080840.1494880037676--

------=_Part_1579_815398046.1494880037676--

.


Author: inkwizytoryankes@gmail.com
Date: Mon, 15 May 2017 13:56:00 -0700 (PDT)
Raw View
------=_Part_1694_357890462.1494881760403
Content-Type: multipart/alternative;
 boundary="----=_Part_1695_1441672771.1494881760404"

------=_Part_1695_1441672771.1494881760404
Content-Type: text/plain; charset="UTF-8"



On Monday, May 15, 2017 at 9:13:18 PM UTC+2, Ville Voutilainen wrote:
>
> On 15 May 2017 at 21:32, Thiago Macieira <thi...@macieira.org
> <javascript:>> wrote:
> >> > tuple and vice-versa is a simple library problem, as is converting
> from
> >> > arrays to either. Converting from a homogeneous tuple to an array or
> an
> >>
> >> It doesn't seem to be such a simple problem, considering that the
> >> current library can't do
> >> it and doing it for permutations of multiple types doesn't scale.
> >
> > Sorry, I didn't follow this.
> >
> > It should be trivial to add a constructor to std::pair that takes
> std::tuple
> > with the same parameters. It should be easy to add a std::tuple
> constructor
>
> Good luck with that trivial exercise. Now, do it again and add a
> constructor to std::pair
> that takes an array. Repeat the exercise for tuple. And array. Now go
> add such things
> to optional and variant while you're at it.
>
> Once you've tried, you may come away thinking that perhaps a language
> extension
> would work better.
>
> > The new language feature would be to initialise an aggregate with
> std::tuple
> > and vice-versa. Given that structured bindings offers std::tuple_size
> and
> > such, we need a language feature that returns the number of elements in
> that
> > aggregate, their types and allows access to the values in a given
> object. We
> > could even call this feature "reflection".
>
> Mere reflection doesn't make it work for all cases. So we need
> something more uniform than that.
>

IIRC having structural binding allow to have "reverse binding" and poor man
reflection.

You can easy create around 20 functions that bind from 1 to 20 values to
tuple from any type that support structural binding.
This is only weak part of this solution but you can codegen this to some
number that is reasonable.

With that you can you can construct any type you want using one variable
template that get that tuple and final type.

--
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/a6608638-451b-4c3f-9f9c-73176d5a7740%40isocpp.org.

------=_Part_1695_1441672771.1494881760404
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><br><br>On Monday, May 15, 2017 at 9:13:18 PM UTC+2, Ville=
 Voutilainen wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;mar=
gin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On 15 May 2=
017 at 21:32, Thiago Macieira &lt;<a href=3D"javascript:" target=3D"_blank"=
 gdf-obfuscated-mailto=3D"crRm3cXaCQAJ" rel=3D"nofollow" onmousedown=3D"thi=
s.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39;ja=
vascript:&#39;;return true;">thi...@macieira.org</a>&gt; wrote:
<br>&gt;&gt; &gt; tuple and vice-versa is a simple library problem, as is c=
onverting from
<br>&gt;&gt; &gt; arrays to either. Converting from a homogeneous tuple to =
an array or an
<br>&gt;&gt;
<br>&gt;&gt; It doesn&#39;t seem to be such a simple problem, considering t=
hat the
<br>&gt;&gt; current library can&#39;t do
<br>&gt;&gt; it and doing it for permutations of multiple types doesn&#39;t=
 scale.
<br>&gt;
<br>&gt; Sorry, I didn&#39;t follow this.
<br>&gt;
<br>&gt; It should be trivial to add a constructor to std::pair that takes =
std::tuple
<br>&gt; with the same parameters. It should be easy to add a std::tuple co=
nstructor
<br>
<br>Good luck with that trivial exercise. Now, do it again and add a
<br>constructor to std::pair
<br>that takes an array. Repeat the exercise for tuple. And array. Now go
<br>add such things
<br>to optional and variant while you&#39;re at it.
<br>
<br>Once you&#39;ve tried, you may come away thinking that perhaps a langua=
ge extension
<br>would work better.
<br>
<br>&gt; The new language feature would be to initialise an aggregate with =
std::tuple
<br>&gt; and vice-versa. Given that structured bindings offers std::tuple_s=
ize and
<br>&gt; such, we need a language feature that returns the number of elemen=
ts in that
<br>&gt; aggregate, their types and allows access to the values in a given =
object. We
<br>&gt; could even call this feature &quot;reflection&quot;.
<br>
<br>Mere reflection doesn&#39;t make it work for all cases. So we need
<br>something more uniform than that.
<br></blockquote><div>=C2=A0</div><div>IIRC having structural binding allow=
 to have &quot;reverse binding&quot; and <span id=3D"result_box" class=3D"s=
hort_text" lang=3D"en"><span class=3D"">poor </span></span>man reflection.<=
br><br>You can easy create around 20 functions that bind from 1 to 20 value=
s to tuple from any type that support structural binding.<br>This is only w=
eak part of this solution but you can codegen this to some number that is r=
easonable.<br><br>With that you can you can construct any type you want usi=
ng one variable template that get that tuple and final type.<br></div></div=
>

<p></p>

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

------=_Part_1695_1441672771.1494881760404--

------=_Part_1694_357890462.1494881760403--

.


Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Mon, 15 May 2017 23:41:21 +0200
Raw View
Le 15/05/2017 =C3=A0 20:32, Thiago Macieira a =C3=A9crit :
> On segunda-feira, 15 de maio de 2017 11:07:45 PDT Ville Voutilainen wrote=
:
>> On 15 May 2017 at 20:53, Thiago Macieira <thiago@macieira.org> wrote:
>>> On segunda-feira, 15 de maio de 2017 09:02:17 PDT Ville Voutilainen wro=
te:
>>>> On 15 May 2017 at 18:56, Thiago Macieira <thiago@macieira.org> wrote:
>>>>> On segunda-feira, 15 de maio de 2017 04:45:28 PDT Antonio Perez wrote=
:
>>>>>> pair p =3D [2,"Hello world"];
>>>>>> array<double, 3> arr =3D [3.7, 9.2, 8.1];
>>>>>> Would be equivalent to:
>>>>>> pair p =3D {2, "Hello world"};
>>>>>> array<double, 3> arr =3D {3.7, 9.2, 8.1};
>>>>> So why do we need another syntax?
>>>> Because a new language facility can convert tuples to pairs, pairs to
>>>> arrays, tuples to arrays,
>>>> arrays to pairs, arrays to tuples and more without those types
>>>> defining conversions between
>>>> each other.
>>> None of that explains why we need the new syntax. Converting from pair =
to
>> It might not need new syntax. That remains to be seen. If there's no
>> new syntax in it,
>> that means that existing syntaxes grow new capabilities.
> That's my point. I don't see any new capability above, hence no need for =
any
> new syntax. The new features you discussed are about variables already
> initialised.
>
>>> tuple and vice-versa is a simple library problem, as is converting from
>>> arrays to either. Converting from a homogeneous tuple to an array or an
>> It doesn't seem to be such a simple problem, considering that the
>> current library can't do
>> it and doing it for permutations of multiple types doesn't scale.
> Sorry, I didn't follow this.
>
> It should be trivial to add a constructor to std::pair that takes std::tu=
ple
> with the same parameters. It should be easy to add a std::tuple construct=
or
> that takes std::pair of the same types (provided there are exactly two of
> them).
You need just to add a constructor from any ProductType with the same=20
elements types ;-)
> The new language feature would be to initialise an aggregate with std::tu=
ple
> and vice-versa.
p0341r0 associates the type <T1, ..., Tn> to {t1, ..., tn}.
I believe this is quite useful. I believe it is unfortunate that the=20
expression {t1, ..., tn} has not type currently.

<T1, ..., Tn> should of course be a product type, and tuple should be=20
constructible from any product type, in particular from <T1, ..., Tn>.

> Given that structured bindings offers std::tuple_size and
> such, we need a language feature that returns the number of elements in t=
hat
> aggregate, their types and allows access to the values in a given object.=
 We
> could even call this feature "reflection".
>
See p0341r0. I don't know who to provide the access to any type=20
supporting by Structured binding using Reflection. There is=20
customization case that cannot be reflected. This the main reason of p327r1=
..

I've requested in the Reflection ML help on this, who the reflection=20
interface could help to reflect structured binding types, but only the=20
easy case for structs was defined.

Vicente

--=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/5adfd918-6798-7885-95f5-dffae41fb761%40wanadoo.f=
r.

.


Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Mon, 15 May 2017 23:44:51 +0200
Raw View
Le 15/05/2017 =C3=A0 18:02, Ville Voutilainen a =C3=A9crit :
> On 15 May 2017 at 18:56, Thiago Macieira <thiago@macieira.org> wrote:
>> On segunda-feira, 15 de maio de 2017 04:45:28 PDT Antonio Perez wrote:
>>> pair p =3D [2,"Hello world"];
>>> array<double, 3> arr =3D [3.7, 9.2, 8.1];
>>> Would be equivalent to:
>>> pair p =3D {2, "Hello world"};
>>> array<double, 3> arr =3D {3.7, 9.2, 8.1};
>> So why do we need another syntax?
>
> Because a new language facility can convert tuples to pairs, pairs to
> arrays, tuples to arrays,
> arrays to pairs, arrays to tuples and more without those types
> defining conversions between
> each other.
>
An unnamed Product type (the members have no special meaning) should be=20
convertible from another ProductType with the same element types (or=20
even from convertibles to). However when the members have a name, this=20
is different.

I don't want a struct Date class to be convertible [int, int, int], at=20
least not implicitly.

As P0327R1 shows that defining constructors that take ProductTypes=20
instead of specific types (as tuple) simplifies a lot the number of=20
needed constructors., but each class should be able to define if these=20
constructors are desired and if they are explicit, or implicit.

Vicente

--=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/e0649fcc-d13b-6215-0364-e8102db12d49%40wanadoo.f=
r.

.


Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Mon, 15 May 2017 23:53:17 +0200
Raw View
This is a multi-part message in MIME format.
--------------6702528E8BCBE9AB8B242D40
Content-Type: text/plain; charset="UTF-8"; format=flowed
Content-Transfer-Encoding: quoted-printable

Le 15/05/2017 =C3=A0 11:49, Antonio Perez a =C3=A9crit :
> Structured binding is an extremely useful concept because it allows=20
> the efficent and intuitive unpacking of data-structures into their=20
> individual values, and it works on a wide range of data structures.=20
> Not only does it work on tuples and pairs, but it also works on=20
> structs defined by the programmer without any additional effort on=20
> their part. I propose making this language feature more complete by=20
> allowing structured binding to take place in reverse:
>
> |
> tuple a =3D{1,3.7};//Creates a tuple of type tuple<int, double> with=20
> values 1 and 3.7
> tuple b =3D[1,3.7];//Ditto
> |
>
> *Where is this useful?*
> The above example isn't particularly useful, HOWEVER here's a more=20
> real usage case:
>
> |
> [double,double]GetAngleVector(doublex)
> {
> return[cos(x),sin(x)];
> }
>
> //All of these would be 100% valid:
> tuple t =3DGetAngleVector(2.7);
> pair p =3DGetAngleVector(2.7);
> array<double,2>arr =3DGetAngleVector(2.7);
> auto[x,y]=3DGetAngleVector(2.7);
>
> structPoint2D{
> doublex,y;
> };
> Point2Dpoint =3DGetAngleVector(2.7);
> |
>
> Here, the function returns a structured-binding that will=20
> automatically map to whatever it's assigned to without issue.
Are you saying that any type supporting structured binding will be=20
constructible from [E1, ..., En] where Ek are the types of its elements.
I could understand the opposite conversion as [E1, ..., En] doesn't give=20
any meaning to Ek other than the position. The types you use in the=20
example share almost all this feature so I understand the conversion,=20
but Point2D is giving a meaning to the first and second elements. The=20
first is the ordinate and the second the coordinate. Would you suggest=20
that given

|    structPoint2DR {
doubley,x;
};
|
|The following will be valid as well?

Point2DRpoint =3DGetAngleVector(2.7);

And

| |Point2DRpoint =3D ||Point2D{0.5, 1.2};

I don't want these implicit constructions.
|
>
>
> Something similar could be achieved in standard C++17, although it's=20
> unseemly and difficult to read:
> |
> tuple<double,double>GetAngleVector(doublex)
> {
> return{cos(x),sin(x)};
> }
>
> //All of these would be 100% valid:
> pair p=20
> =3Dstd::make_from_tuple<pair<double,double>,tuple<double,double>>(GetAngl=
eVector(2.7));
> array<double,2>arr=20
> =3Dstd::make_from_tuple<std::array<double,2>,tuple<double,double>>(GetAng=
leVector(2.7));
>
> structPoint2D{
> doublex,y;
> };
> Point2Dpoint=20
> =3Dstd::make_from_tuple<Point2D,tuple<double,double>>(GetAngleVector(2.7)=
)
> |
>
>
You don't need to give the second parameter to make_from_tuple.

With the P0327R1 you could have

|
tuple<double,double>GetAngleVector(doublex)
{
return{cos(x),sin(x)};
}

pair p =3Dproduct_type::make_from<pair>(GetAngleVector(2.7));
array<double,2>arr=20
=3D|product_type::make_from<array_tc>|(GetAngleVector(2.7));

structPoint2D{
doublex,y;
};
Point2Dpoint =3D|product_type::|make_from<Point2D>(GetAngleVector(2.7))

|

if product_type::make_from uses T{t1, ..., tn} instead T(t1, ..., tn).=20
(This is not the case today), but we could define a=20
product_type::make_from2 that has this semantics.


Note that the construction is explicit in this case.


Vicente

--=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/eb8e2761-961a-ea51-b56e-f914a43b53c0%40wanadoo.f=
r.

--------------6702528E8BCBE9AB8B242D40
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<html>
  <head>
    <meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
  </head>
  <body bgcolor=3D"#FFFFFF" text=3D"#000000">
    <div class=3D"moz-cite-prefix">Le 15/05/2017 =C3=A0 11:49, Antonio Pere=
z a
      =C3=A9crit=C2=A0:<br>
    </div>
    <blockquote
      cite=3D"mid:db270137-954e-4883-904c-0a3eb378b8c3@isocpp.org"
      type=3D"cite">
      <div dir=3D"ltr">Structured binding is an extremely useful concept
        because it allows the efficent and intuitive unpacking of
        data-structures into their individual values, and it works on a
        wide range of data structures. Not only does it work on tuples
        and pairs, but it also works on structs defined by the
        programmer without any additional effort on their part. I
        propose making this language feature more complete by allowing
        structured binding to take place in reverse:
        <div><br>
        </div>
        <div>
          <div class=3D"prettyprint" style=3D"background-color: rgb(250,
            250, 250); border-color: rgb(187, 187, 187); border-style:
            solid; border-width: 1px; word-wrap: break-word;"><code
              class=3D"prettyprint">
              <div class=3D"subprettyprint"><span style=3D"color: #000;"
                  class=3D"styled-by-prettify">tuple a </span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">=3D</=
span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">{</sp=
an><span
                  style=3D"color: #066;" class=3D"styled-by-prettify">1</sp=
an><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #066;" class=3D"styled-by-prettify">3.7</=
span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">};</s=
pan><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #800;" class=3D"styled-by-prettify">//Cre=
ates
                  a tuple of type tuple&lt;int, double&gt; with values 1
                  and 3.7</span><span style=3D"color: #000;"
                  class=3D"styled-by-prettify"><br>
                  tuple b </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: #660;" class=3D"styled-by-prettify">[</sp=
an><span
                  style=3D"color: #066;" class=3D"styled-by-prettify">1</sp=
an><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #066;" class=3D"styled-by-prettify">3.7</=
span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">];</s=
pan><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #800;" class=3D"styled-by-prettify">//Dit=
to</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                </span></div>
            </code></div>
          <br>
          =C2=A0<b>Where is this useful?</b></div>
        <div>The above example isn't particularly useful, HOWEVER here's
          a more real usage case:</div>
        <div><br>
        </div>
        <div>
          <div class=3D"prettyprint" style=3D"background-color: rgb(250,
            250, 250); border-color: rgb(187, 187, 187); border-style:
            solid; border-width: 1px; word-wrap: break-word;"><code
              class=3D"prettyprint">
              <div class=3D"subprettyprint"><span style=3D"color: #660;"
                  class=3D"styled-by-prettify">[</span><span style=3D"color=
:
                  #008;" class=3D"styled-by-prettify">double</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">]</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #606;" class=3D"styled-by-prettify">GetAn=
gleVector</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> x</s=
pan><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">)</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                </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">return</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">[</sp=
an><font
                  color=3D"#000000"><span style=3D"color: #000;"
                    class=3D"styled-by-prettify">cos</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: #660;" class=3D"styled-by-prettify">),<=
/span><span
                    style=3D"color: #000;" class=3D"styled-by-prettify"> si=
n</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: #660;" class=3D"styled-by-prettify">)];=
</span></font><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                </span><span style=3D"color: #660;"
                  class=3D"styled-by-prettify">}</span><span style=3D"color=
:
                  #000;" class=3D"styled-by-prettify"><br>
                  <br>
                </span><span style=3D"color: #800;"
                  class=3D"styled-by-prettify">//All of these would be
                  100% valid:</span><span style=3D"color: #000;"
                  class=3D"styled-by-prettify"><br>
                  tuple t </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: #606;" class=3D"styled-by-prettify">GetAn=
gleVector</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span
                  style=3D"color: #066;" class=3D"styled-by-prettify">2.7</=
span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">);</s=
pan><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                  pair p </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: #606;" class=3D"styled-by-prettify">GetAn=
gleVector</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span
                  style=3D"color: #066;" class=3D"styled-by-prettify">2.7</=
span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">);</s=
pan><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                  array</span><span style=3D"color: #660;"
                  class=3D"styled-by-prettify">&lt;</span><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #066;" class=3D"styled-by-prettify">2</sp=
an><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&gt;<=
/span><font
                  color=3D"#000000"><span style=3D"color: #000;"
                    class=3D"styled-by-prettify"> arr </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: #606;" class=3D"styled-by-prettify">Get=
AngleVector</span><span
                    style=3D"color: #660;" class=3D"styled-by-prettify">(</=
span><span
                    style=3D"color: #066;" class=3D"styled-by-prettify">2.7=
</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: #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">x</=
span><span
                    style=3D"color: #660;" class=3D"styled-by-prettify">,</=
span><span
                    style=3D"color: #000;" class=3D"styled-by-prettify">y</=
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">=3D=
</span><span
                    style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span
                    style=3D"color: #606;" class=3D"styled-by-prettify">Get=
AngleVector</span><span
                    style=3D"color: #660;" class=3D"styled-by-prettify">(</=
span><span
                    style=3D"color: #066;" class=3D"styled-by-prettify">2.7=
</span><span
                    style=3D"color: #660;" class=3D"styled-by-prettify">);<=
/span><span
                    style=3D"color: #000;" class=3D"styled-by-prettify"><br=
>
                    <br>
                  </span><span style=3D"color: #008;"
                    class=3D"styled-by-prettify">struct</span><span
                    style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span
                    style=3D"color: #606;" class=3D"styled-by-prettify">Poi=
nt2D</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"><br=
>
                    =C2=A0 =C2=A0 </span><span style=3D"color: #008;"
                    class=3D"styled-by-prettify">double</span><span
                    style=3D"color: #000;" class=3D"styled-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">y</=
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">};</span><span
                    style=3D"color: #000;" class=3D"styled-by-prettify"><br=
>
                  </span><span style=3D"color: #606;"
                    class=3D"styled-by-prettify">Point2D</span><span
                    style=3D"color: #000;" class=3D"styled-by-prettify">
                    point </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: #606;" class=3D"styled-by-prettify">Get=
AngleVector</span><span
                    style=3D"color: #660;" class=3D"styled-by-prettify">(</=
span><span
                    style=3D"color: #066;" class=3D"styled-by-prettify">2.7=
</span><span
                    style=3D"color: #660;" class=3D"styled-by-prettify">);<=
/span></font></div>
            </code></div>
          <br>
          Here, the function returns a structured-binding that will
          automatically map to whatever it's assigned to without issue.
          <br>
        </div>
      </div>
    </blockquote>
    Are you saying that any type supporting structured binding will be
    constructible from [E1, ..., En] where Ek are the types of its
    elements.<br>
    I could understand the opposite conversion as [E1, ..., En] doesn't
    give any meaning to Ek other than the position. The types you use in
    the example share almost all this feature so I understand the
    conversion, but Point2D is giving a meaning to the first and second
    elements. The first is the ordinate and the second the coordinate.
    Would you suggest that given<br>
    <br>
    <code class=3D"prettyprint"><font color=3D"#000000"><span style=3D"colo=
r:
          #008;" class=3D"styled-by-prettify">=C2=A0=C2=A0=C2=A0 struct</sp=
an><span
          style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span
          style=3D"color: #606;" class=3D"styled-by-prettify">Point2D</span=
><span
          style=3D"color: #000;" class=3D"styled-by-prettify">R </span><spa=
n
          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=C2=A0 </span><span style=3D"color: #00=
8;"
          class=3D"styled-by-prettify">double</span><span style=3D"color:
          #000;" class=3D"styled-by-prettify"> y</span><span style=3D"color=
:
          #660;" class=3D"styled-by-prettify">,<font color=3D"#000000">x</f=
ont></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"><br>
        </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
=C2=A0=C2=A0=C2=A0
          };</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br>
        </span><span style=3D"color: #606;" class=3D"styled-by-prettify"></=
span></font></code><br>
    <code class=3D"prettyprint"><font color=3D"#000000"><span style=3D"colo=
r:
          #000;" class=3D"styled-by-prettify">The following will be valid
          as well?<br>
          <br>
        </span><span style=3D"color: #606;" class=3D"styled-by-prettify">=
=C2=A0=C2=A0=C2=A0
          Point2DR</span><span style=3D"color: #000;"
          class=3D"styled-by-prettify"> point </span><span style=3D"color:
          #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"colo=
r:
          #000;" class=3D"styled-by-prettify"> </span><span style=3D"color:
          #606;" class=3D"styled-by-prettify">GetAngleVector</span><span
          style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span
          style=3D"color: #066;" class=3D"styled-by-prettify">2.7</span><sp=
an
          style=3D"color: #660;" class=3D"styled-by-prettify">);<br>
          <br>
          <font color=3D"#000000">And <br>
            <br>
          </font></span></font></code>=C2=A0=C2=A0=C2=A0 <code class=3D"pre=
ttyprint"><font
        color=3D"#000000"><span style=3D"color: #606;"
          class=3D"styled-by-prettify">Point2DR</span><span style=3D"color:
          #000;" class=3D"styled-by-prettify"> point =3D </span></font></co=
de><code
      class=3D"prettyprint"><font color=3D"#000000"><span style=3D"color:
          #606;" class=3D"styled-by-prettify">Point2D<font color=3D"#000000=
">{0.5,
            1.2};<br>
            <br>
            I don't want these implicit constructions.<br>
          </font></span></font></code>
    <blockquote
      cite=3D"mid:db270137-954e-4883-904c-0a3eb378b8c3@isocpp.org"
      type=3D"cite">
      <div dir=3D"ltr">
        <div><br>
        </div>
        <div><br>
        </div>
        <div>Something similar could be achieved in standard C++17,
          although it's unseemly and difficult to read:</div>
        <div>
          <div class=3D"prettyprint" style=3D"background-color: rgb(250,
            250, 250); border-color: rgb(187, 187, 187); border-style:
            solid; border-width: 1px; word-wrap: break-word;"><code
              class=3D"prettyprint">
              <div class=3D"subprettyprint"><span style=3D"color: #000;"
                  class=3D"styled-by-prettify">tuple</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&lt;<=
/span><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&gt;<=
/span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #606;" class=3D"styled-by-prettify">GetAn=
gleVector</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> x</s=
pan><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">)</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                </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">return</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><font
                  color=3D"#666600"><span style=3D"color: #660;"
                    class=3D"styled-by-prettify">{</span></font><font
                  color=3D"#000000"><span style=3D"color: #000;"
                    class=3D"styled-by-prettify">cos</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: #660;" class=3D"styled-by-prettify">),<=
/span><span
                    style=3D"color: #000;" class=3D"styled-by-prettify"> si=
n</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: #660;" class=3D"styled-by-prettify">)};=
</span></font><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                </span><span style=3D"color: #660;"
                  class=3D"styled-by-prettify">}</span><span style=3D"color=
:
                  #000;" class=3D"styled-by-prettify"><br>
                  <br>
                </span><span style=3D"color: #800;"
                  class=3D"styled-by-prettify">//All of these would be
                  100% valid:</span><span style=3D"color: #000;"
                  class=3D"styled-by-prettify"><br>
                  pair p </span><span style=3D"color: #660;"
                  class=3D"styled-by-prettify">=3D</span><span style=3D"col=
or:
                  #000;" class=3D"styled-by-prettify"> std</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">::</s=
pan><span
                  style=3D"color: #000;" class=3D"styled-by-prettify">make_=
from_tuple</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&lt;<=
/span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify">pair<=
/span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&lt;<=
/span><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&gt;,=
</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> tupl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&lt;<=
/span><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&gt;&=
gt;(</span><span
                  style=3D"color: #606;" class=3D"styled-by-prettify">GetAn=
gleVector</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span
                  style=3D"color: #066;" class=3D"styled-by-prettify">2.7</=
span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">));</=
span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                  array</span><span style=3D"color: #660;"
                  class=3D"styled-by-prettify">&lt;</span><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #066;" class=3D"styled-by-prettify">2</sp=
an><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&gt;<=
/span><font
                  color=3D"#000000"><span style=3D"color: #000;"
                    class=3D"styled-by-prettify"> arr </span><span
                    style=3D"color: #660;" class=3D"styled-by-prettify">=3D=
</span><span
                    style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span></font><span
                  style=3D"color: #000;" class=3D"styled-by-prettify">std</=
span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">::</s=
pan><span
                  style=3D"color: #000;" class=3D"styled-by-prettify">make_=
from_tuple</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&lt;<=
/span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify">std</=
span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">::</s=
pan><span
                  style=3D"color: #000;" class=3D"styled-by-prettify">array=
</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&lt;<=
/span><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span
                  style=3D"color: #066;" class=3D"styled-by-prettify">2</sp=
an><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&gt;,=
</span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> tupl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&lt;<=
/span><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&gt;&=
gt;(</span><span
                  style=3D"color: #606;" class=3D"styled-by-prettify">GetAn=
gleVector</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span
                  style=3D"color: #066;" class=3D"styled-by-prettify">2.7</=
span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">));</=
span><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"><br>
                </span><font color=3D"#000000"><span style=3D"color: #000;"
                    class=3D"styled-by-prettify"><br>
                  </span><span style=3D"color: #008;"
                    class=3D"styled-by-prettify">struct</span><span
                    style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span
                    style=3D"color: #606;" class=3D"styled-by-prettify">Poi=
nt2D</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"><br=
>
                    =C2=A0 =C2=A0 </span><span style=3D"color: #008;"
                    class=3D"styled-by-prettify">double</span><span
                    style=3D"color: #000;" class=3D"styled-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">y</=
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">};</span><span
                    style=3D"color: #000;" class=3D"styled-by-prettify"><br=
>
                  </span><span style=3D"color: #606;"
                    class=3D"styled-by-prettify">Point2D</span><span
                    style=3D"color: #000;" class=3D"styled-by-prettify">
                    point </span><span style=3D"color: #660;"
                    class=3D"styled-by-prettify">=3D</span><span
                    style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span></font><span
                  style=3D"color: #000;" class=3D"styled-by-prettify">std</=
span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">::</s=
pan><span
                  style=3D"color: #000;" class=3D"styled-by-prettify">make_=
from_tuple</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&lt;<=
/span><font
                  color=3D"#000000"><span style=3D"color: #606;"
                    class=3D"styled-by-prettify">Point2D</span></font><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span
                  style=3D"color: #000;" class=3D"styled-by-prettify"> tupl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&lt;<=
/span><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span
                  style=3D"color: #008;" class=3D"styled-by-prettify">doubl=
e</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">&gt;&=
gt;(</span><span
                  style=3D"color: #606;" class=3D"styled-by-prettify">GetAn=
gleVector</span><span
                  style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span
                  style=3D"color: #066;" class=3D"styled-by-prettify">2.7</=
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>
          <br>
        </div>
      </div>
    </blockquote>
    You don't need to give the second parameter to make_from_tuple.<br>
    <br>
    With the P0327R1 you could have<br>
    <br>
    <div class=3D"prettyprint" style=3D"background-color: rgb(250, 250,
      250); border-color: rgb(187, 187, 187); border-style: solid;
      border-width: 1px; word-wrap: break-word;"><code
        class=3D"prettyprint">
        <div class=3D"subprettyprint"><span style=3D"color: #000;"
            class=3D"styled-by-prettify">tuple</span><span style=3D"color:
            #660;" class=3D"styled-by-prettify">&lt;</span><span
            style=3D"color: #008;" class=3D"styled-by-prettify">double</spa=
n><span
            style=3D"color: #660;" class=3D"styled-by-prettify">,</span><sp=
an
            style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an
            style=3D"color: #008;" class=3D"styled-by-prettify">double</spa=
n><span
            style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span>=
<span
            style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an
            style=3D"color: #606;" class=3D"styled-by-prettify">GetAngleVec=
tor</span><span
            style=3D"color: #660;" class=3D"styled-by-prettify">(</span><sp=
an
            style=3D"color: #008;" class=3D"styled-by-prettify">double</spa=
n><span
            style=3D"color: #000;" class=3D"styled-by-prettify"> x</span><s=
pan
            style=3D"color: #660;" class=3D"styled-by-prettify">)</span><sp=
an
            style=3D"color: #000;" class=3D"styled-by-prettify"><br>
          </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">return</span><span style=3D"color:
            #000;" class=3D"styled-by-prettify"> </span><font
            color=3D"#666600"><span style=3D"color: #660;"
              class=3D"styled-by-prettify">{</span></font><font
            color=3D"#000000"><span style=3D"color: #000;"
              class=3D"styled-by-prettify">cos</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: #660;" class=3D"styled-by-prettify">),</span>=
<span
              style=3D"color: #000;" class=3D"styled-by-prettify"> sin</spa=
n><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: #660;" class=3D"styled-by-prettify">)};</span=
></font><span
            style=3D"color: #000;" class=3D"styled-by-prettify"><br>
          </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
}</span><span
            style=3D"color: #000;" class=3D"styled-by-prettify"><br>
            <br>
          </span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
pair
            p </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;" class=3D"styled-by-prettify">product_typ=
e::</span><span
            style=3D"color: #000;" class=3D"styled-by-prettify">make_from</=
span><span
            style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span>=
<span
            style=3D"color: #000;" class=3D"styled-by-prettify">pair</span>=
<span
            style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span>=
<span
            style=3D"color: #660;" class=3D"styled-by-prettify">(</span><sp=
an
            style=3D"color: #606;" class=3D"styled-by-prettify">GetAngleVec=
tor</span><span
            style=3D"color: #660;" class=3D"styled-by-prettify">(</span><sp=
an
            style=3D"color: #066;" class=3D"styled-by-prettify">2.7</span><=
span
            style=3D"color: #660;" class=3D"styled-by-prettify">));</span><=
span
            style=3D"color: #000;" class=3D"styled-by-prettify"><br>
            array</span><span style=3D"color: #660;"
            class=3D"styled-by-prettify">&lt;</span><span style=3D"color:
            #008;" class=3D"styled-by-prettify">double</span><span
            style=3D"color: #660;" class=3D"styled-by-prettify">,</span><sp=
an
            style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an
            style=3D"color: #066;" class=3D"styled-by-prettify">2</span><sp=
an
            style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span>=
<font
            color=3D"#000000"><span style=3D"color: #000;"
              class=3D"styled-by-prettify"> arr </span><span
              style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span=
><span
              style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
/font><code
            class=3D"prettyprint"><span style=3D"color: #660;"
              class=3D"styled-by-prettify">product_type::</span><span
              style=3D"color: #000;" class=3D"styled-by-prettify">make_from=
</span><span
              style=3D"color: #660;" class=3D"styled-by-prettify">&lt;array=
</span><span
              style=3D"color: #660;" class=3D"styled-by-prettify">_tc&gt;</=
span></code><span
            style=3D"color: #660;" class=3D"styled-by-prettify">(</span><sp=
an
            style=3D"color: #606;" class=3D"styled-by-prettify">GetAngleVec=
tor</span><span
            style=3D"color: #660;" class=3D"styled-by-prettify">(</span><sp=
an
            style=3D"color: #066;" class=3D"styled-by-prettify">2.7</span><=
span
            style=3D"color: #660;" class=3D"styled-by-prettify">));</span><=
span
            style=3D"color: #000;" class=3D"styled-by-prettify"><br>
          </span><font color=3D"#000000"><span style=3D"color: #000;"
              class=3D"styled-by-prettify"><br>
            </span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">struct</span><span
              style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span
              style=3D"color: #606;" class=3D"styled-by-prettify">Point2D</=
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"><br>
              =C2=A0 =C2=A0 </span><span style=3D"color: #008;"
              class=3D"styled-by-prettify">double</span><span
              style=3D"color: #000;" class=3D"styled-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">y</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=
">};</span><span
              style=3D"color: #000;" class=3D"styled-by-prettify"><br>
            </span><span style=3D"color: #606;" class=3D"styled-by-prettify=
">Point2D</span><span
              style=3D"color: #000;" class=3D"styled-by-prettify"> point </=
span><span
              style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span=
><span
              style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
/font><code
            class=3D"prettyprint"><span style=3D"color: #000;"
              class=3D"styled-by-prettify"></span><span style=3D"color:
              #660;" class=3D"styled-by-prettify">product_type::</span></co=
de><span
            style=3D"color: #660;" class=3D"styled-by-prettify"></span><spa=
n
            style=3D"color: #000;" class=3D"styled-by-prettify">make_from</=
span><span
            style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span>=
<font
            color=3D"#000000"><span style=3D"color: #606;"
              class=3D"styled-by-prettify">Point2D</span></font><span
            style=3D"color: #660;" class=3D"styled-by-prettify">&gt;(</span=
><span
            style=3D"color: #606;" class=3D"styled-by-prettify">GetAngleVec=
tor</span><span
            style=3D"color: #660;" class=3D"styled-by-prettify">(</span><sp=
an
            style=3D"color: #066;" class=3D"styled-by-prettify">2.7</span><=
span
            style=3D"color: #660;" class=3D"styled-by-prettify">))<br>
            <br>
          </span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
</span></div>
      </code></div>
    <br>
    if product_type::make_from uses T{t1, ..., tn} instead T(t1, ...,
    tn). (This is not the case today), but we could define a
    product_type::make_from2 that has this semantics.<br>
    =C2=A0<br>
    <br>
    Note that the construction is explicit in this case.<br>
    <br>
    <br>
    Vicente<br>
  </body>
</html>

<p></p>

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

--------------6702528E8BCBE9AB8B242D40--

.


Author: "Vicente J. Botet Escriba" <vicente.botet@wanadoo.fr>
Date: Tue, 16 May 2017 00:12:04 +0200
Raw View
This is a multi-part message in MIME format.
--------------2D3BBB644C909800AF308043
Content-Type: text/plain; charset="UTF-8"; format=flowed
Content-Transfer-Encoding: quoted-printable

Le 15/05/2017 =C3=A0 22:27, HarD Gamer a =C3=A9crit :
> https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/xdz8o0=
6M9Fk
I'll repeat my comment on this thread, in case you want to say what do=20
you think of P0341?.

    Maybe you will be interested in

    http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2016/p0341r0.html
    <http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2016/p0341r0.html>

    In particular the pack types and the named pack types are very similar
    to what you are proposing in your paper ;-)


Vicente

--=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/fd70e266-f1b1-7d4f-7d8b-3d58be2e072a%40wanadoo.f=
r.

--------------2D3BBB644C909800AF308043
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<html>
  <head>
    <meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
  </head>
  <body bgcolor=3D"#FFFFFF" text=3D"#000000">
    <div class=3D"moz-cite-prefix">Le 15/05/2017 =C3=A0 22:27, HarD Gamer a
      =C3=A9crit=C2=A0:<br>
    </div>
    <blockquote
      cite=3D"mid:f9b48628-03b3-4ae0-ac76-88839359dbc5@isocpp.org"
      type=3D"cite">
      <div dir=3D"ltr"><a class=3D"moz-txt-link-freetext" href=3D"https://g=
roups.google.com/a/isocpp.org/forum/#!topic/std-proposals/xdz8o06M9Fk">http=
s://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/xdz8o06M9Fk<=
/a><br>
      </div>
    </blockquote>
    I'll repeat my comment on this thread, in case you want to say what
    do you think of P0341?.<br>
    <br>
    <meta http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf-8=
">
    <blockquote>Maybe you will be interested in
      <br>
      <br>
      <a
href=3D"http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2016/p0341r0.htm=
l"
        target=3D"_blank" rel=3D"nofollow"
onmousedown=3D"this.href=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww=
..open-std.org%2FJTC1%2FSC22%2FWG21%2Fdocs%2Fpapers%2F2016%2Fp0341r0.html\x2=
6sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGwD2VwlamNnFA6Q-QI3BjeTKb-QQ';return
        true;"
onclick=3D"this.href=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.ope=
n-std.org%2FJTC1%2FSC22%2FWG21%2Fdocs%2Fpapers%2F2016%2Fp0341r0.html\x26sa\=
x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGwD2VwlamNnFA6Q-QI3BjeTKb-QQ';return
        true;">http://www.open-std.org/JTC1/<wbr>SC22/WG21/docs/papers/2016=
/<wbr>p0341r0.html</a>
      <br>
      <br>
      In particular the pack types and the named pack types are very
      similar <br>
      to what you are proposing in your paper ;-)
      <br>
    </blockquote>
    <br>
    Vicente<br>
  </body>
</html>

<p></p>

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

--------------2D3BBB644C909800AF308043--

.