Topic: omch


Author: "ma.kalbfuss via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Tue, 31 Oct 2017 11:00:09 -0700 (PDT)
Raw View
------=_Part_9072_737675120.1509472809598
Content-Type: multipart/alternative;
 boundary="----=_Part_9073_75887700.1509472809599"

------=_Part_9073_75887700.1509472809599
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable



Hi Guys,

If we have a container type like...
=20
template <typename E, size_t S>
class Container
{

  public:

    template <typename... Args>
    Container(Args&&... args)
        : data(std::forward<Args>(args)...)
    { }

  private:

    E data[S];

};

We can initialize the container with

Container<int, 5> c{ 0, 1, 2, 3, 4, 5 };

But if we have a more complex element type like a class or struct we cannot=
 write

Container<Element, 5> c{ { 1, "1" }, { 2, "2" }, { 3, "3" }, { 4, "4" }, { =
5, "5" } };

The compiler cannot deduce the type. We would have to write

Container<Element, 5> c{ Element{ 1, "1" }, Element{ 2, "2" }, Element{ 3, =
"3" }, Element{ 4, "4" }, Element{ 5, "5" } };

That is not what we want. We could use std::initializer_list, but the initi=
alizer list could be of different size. We would have to add a runtime chec=
k.
If initializer_list would allow an optional size parameter. The container c=
ode could look like the following

template <typename E, size_t N>
class Container
{

  public:

    Container(std::initializer_list<E, N> il)
    {
        std::copy_n(il.begin(), N, data);
    }

  private:

    E data[N];

};

Now we could write

Container<Element, 5> c{ { 1, "1" }, { 2, "2" }, { 3, "3" }, { 4, "4" }, { =
5, "5" } };

If the number of elements differ the compiler can detect the error:

Container<Element, 5> c{ { 1, "1" }, { 2, "2" }, { 3, "3" }, { 4, "4" }, { =
5, "5" }, { 6, "6"} }; // error: too much elements

In combination with deduction guides, allowing a partial deduction, it woul=
d be possible to write

Container<Element> c{ { 1, "1" }, { 2, "2" }, { 3, "3" }, { 4, "4" }, { 5, =
"5" } };

Kind Regards,
Martin Kalbfu=C3=9F


--=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/8a66452c-6711-43e4-becd-8e4cef5ea232%40isocpp.or=
g.

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

<div dir=3D"ltr"><pre>Hi Guys,

If we have a container type like...<br>=C2=A0<div style=3D"background-color=
: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid=
; border-width: 1px; overflow-wrap: break-word;" class=3D"prettyprint"><cod=
e class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color:=
 #008;" class=3D"styled-by-prettify">template</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">typename</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> E</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> size_t S</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">class</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span sty=
le=3D"color: #606;" class=3D"styled-by-prettify">Container</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br><br>=C2=A0 </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">public</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">:</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br><br>=C2=A0 =C2=A0 </span><span style=3D"color:=
 #008;" class=3D"styled-by-prettify">template</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">typename</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">...</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify=
">Args</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0=
 =C2=A0 </span><span style=3D"color: #606;" class=3D"styled-by-prettify">Co=
ntainer</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</=
span><span style=3D"color: #606;" class=3D"styled-by-prettify">Args</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">&amp;&amp;...</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> args</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">)</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">:</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> data</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">std</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify">forward</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #606;" class=
=3D"styled-by-prettify">Args</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">&gt;(</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify">args</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">)...)</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>=C2=A0 </=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">private</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">:</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br><br>=C2=A0 =C2=A0 E =
data</span><span style=3D"color: #660;" class=3D"styled-by-prettify">[</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify">S</span><span s=
tyle=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"co=
lor: #660;" class=3D"styled-by-prettify">};</span></div></code></div>
We can initialize the container with

<div style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, =
187, 187); border-style: solid; border-width: 1px; overflow-wrap: break-wor=
d;" class=3D"prettyprint"><code class=3D"prettyprint"><div class=3D"subpret=
typrint"><span style=3D"color: #606;" class=3D"styled-by-prettify">Containe=
r</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</spa=
n><span style=3D"color: #008;" class=3D"styled-by-prettify">int</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">5</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> c</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #066;" class=3D"styled-by-prettify">0</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">1</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #066;" class=3D"style=
d-by-prettify">2</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: #066;" class=3D"styled-by-prettify">3</span><spa=
n 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">4</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">5</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">};</spa=
n></div></code></div>
But if we have a more complex element type like a class or struct we cannot=
 write

<div style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, =
187, 187); border-style: solid; border-width: 1px; overflow-wrap: break-wor=
d;" class=3D"prettyprint"><code class=3D"prettyprint"><div class=3D"subpret=
typrint"><span style=3D"color: #606;" class=3D"styled-by-prettify">Containe=
r</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</spa=
n><span style=3D"color: #606;" class=3D"styled-by-prettify">Element</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #066;" class=3D"styled-by-prettify">5</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> c</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: #660;" class=3D"styled-by-prettify">{<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #066;" class=3D"styled-by-prettify">1</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;1&quot;</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"styl=
ed-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #066;" class=3D"styled-by-prettify">2</span><sp=
an 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;2&quot;</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"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #066;" class=3D"styled-by-prettify">3</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #080;" class=3D"styled-by-prettify">&quot;3&quot;</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">},</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pret=
tify">4</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: #080;" class=3D"styled-by-prettify">&quot;4&quot;</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">},</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #066;" class=3D"style=
d-by-prettify">5</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: #080;" class=3D"styled-by-prettify">&quot;5&quot=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">};</span></div></code></div>
The compiler cannot deduce the type. We would have to write

<div style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, =
187, 187); border-style: solid; border-width: 1px; overflow-wrap: break-wor=
d;" class=3D"prettyprint"><code class=3D"prettyprint"><div class=3D"subpret=
typrint"><span style=3D"color: #606;" class=3D"styled-by-prettify">Containe=
r</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</spa=
n><span style=3D"color: #606;" class=3D"styled-by-prettify">Element</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #066;" class=3D"styled-by-prettify">5</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> c</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: #606;" class=3D"styled-by-prettify">El=
ement</span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #066;" class=3D"styled-by-prettify">1</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #080;" clas=
s=3D"styled-by-prettify">&quot;1&quot;</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">},</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify=
">Element</span><span style=3D"color: #660;" class=3D"styled-by-prettify">{=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan 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;2&quot;</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"styl=
ed-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-pre=
ttify">Element</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><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: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #0=
80;" class=3D"styled-by-prettify">&quot;3&quot;</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">},</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by=
-prettify">Element</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #066;" class=3D"styled-by-prettify">4</span><s=
pan 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;4&quot;</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"> </span><span style=3D"color: #606;" class=3D"style=
d-by-prettify">Element</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #066;" class=3D"styled-by-prettify">5</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: #080;" class=3D"styled-by-prettify">&quot;5&quot;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">};</span></div></code></div>
That is not what we want. We could use std::initializer_list, but the initi=
alizer list could be of different size. We would have to add a runtime chec=
k.
If initializer_list would allow an optional size parameter. The container c=
ode could look like the following

<div style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, =
187, 187); border-style: solid; border-width: 1px; overflow-wrap: break-wor=
d;" class=3D"prettyprint"><code class=3D"prettyprint"><div class=3D"subpret=
typrint"><span style=3D"color: #008;" class=3D"styled-by-prettify">template=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </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">typename</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> E</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> size_t N</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">class</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-pretti=
fy">Container</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><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>=C2=
=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">public=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">:</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>=C2=A0 =C2=
=A0 </span><span style=3D"color: #606;" class=3D"styled-by-prettify">Contai=
ner</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">std</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify">initializer_list</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">&lt;</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify">E</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> N</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">&gt;</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> il</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify">copy_n</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
il</span><span style=3D"color: #660;" class=3D"styled-by-prettify">.</span>=
<span style=3D"color: #008;" class=3D"styled-by-prettify">begin</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">(),</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> N</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> data</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">);</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br><br>=C2=A0 </span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">private</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">:</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br><br>=C2=A0 =C2=A0 E data</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">[</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify">N</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">];</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">}=
;</span></div></code></div><br>Now we could write

<div style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, =
187, 187); border-style: solid; border-width: 1px; overflow-wrap: break-wor=
d;" class=3D"prettyprint"><code class=3D"prettyprint"><div class=3D"subpret=
typrint"><span style=3D"color: #606;" class=3D"styled-by-prettify">Containe=
r</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</spa=
n><span style=3D"color: #606;" class=3D"styled-by-prettify">Element</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #066;" class=3D"styled-by-prettify">5</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> c</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: #660;" class=3D"styled-by-prettify">{<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #066;" class=3D"styled-by-prettify">1</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;1&quot;</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"styl=
ed-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #066;" class=3D"styled-by-prettify">2</span><sp=
an 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;2&quot;</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"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #066;" class=3D"styled-by-prettify">3</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #080;" class=3D"styled-by-prettify">&quot;3&quot;</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">},</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pret=
tify">4</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: #080;" class=3D"styled-by-prettify">&quot;4&quot;</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">},</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #066;" class=3D"style=
d-by-prettify">5</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: #080;" class=3D"styled-by-prettify">&quot;5&quot=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">};</span></div></code></div><br>If t=
he number of elements differ the compiler can detect the error:

<div style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, =
187, 187); border-style: solid; border-width: 1px; overflow-wrap: break-wor=
d;" class=3D"prettyprint"><code class=3D"prettyprint"><div class=3D"subpret=
typrint"><span style=3D"color: #606;" class=3D"styled-by-prettify">Containe=
r</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</spa=
n><span style=3D"color: #606;" class=3D"styled-by-prettify">Element</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #066;" class=3D"styled-by-prettify">5</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> c</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: #660;" class=3D"styled-by-prettify">{<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #066;" class=3D"styled-by-prettify">1</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;1&quot;</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"styl=
ed-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #066;" class=3D"styled-by-prettify">2</span><sp=
an 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;2&quot;</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"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #066;" class=3D"styled-by-prettify">3</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #080;" class=3D"styled-by-prettify">&quot;3&quot;</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">},</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pret=
tify">4</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: #080;" class=3D"styled-by-prettify">&quot;4&quot;</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">},</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #066;" class=3D"style=
d-by-prettify">5</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: #080;" class=3D"styled-by-prettify">&quot;5&quot=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">},</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #066;" class=
=3D"styled-by-prettify">6</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #080;" class=3D"styled-by-prettify">&qu=
ot;6&quot;</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">};</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #800;" class=3D"styled-by-prettify">// error: too much elements</span><=
/div></code></div>
In combination with deduction guides, allowing a partial deduction, it woul=
d be possible to write

<div style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, =
187, 187); border-style: solid; border-width: 1px; overflow-wrap: break-wor=
d;" class=3D"prettyprint"><code class=3D"prettyprint"><div class=3D"subpret=
typrint"><span style=3D"color: #606;" class=3D"styled-by-prettify">Containe=
r</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</spa=
n><span style=3D"color: #606;" class=3D"styled-by-prettify">Element</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> c</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pre=
ttify">1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #080;" class=3D"styled-by-prettify">&quot;1&quot;</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">},</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </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"style=
d-by-prettify">2</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: #080;" class=3D"styled-by-prettify">&quot;2&quot=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">},</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #066;" class=
=3D"styled-by-prettify">3</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #080;" class=3D"styled-by-prettify">&qu=
ot;3&quot;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">},</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #066;=
" class=3D"styled-by-prettify">4</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: #080;" class=3D"styled-by-pret=
tify">&quot;4&quot;</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
},</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #066;" class=3D"styled-by-prettify">5</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"style=
d-by-prettify">&quot;5&quot;</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">};</span>=
</div></code></div>
Kind Regards,
Martin Kalbfu=C3=9F

</pre></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/8a66452c-6711-43e4-becd-8e4cef5ea232%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/8a66452c-6711-43e4-becd-8e4cef5ea232=
%40isocpp.org</a>.<br />

------=_Part_9073_75887700.1509472809599--

------=_Part_9072_737675120.1509472809598--

.


Author: "ma.kalbfuss via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Tue, 31 Oct 2017 11:02:43 -0700 (PDT)
Raw View
------=_Part_8869_2114406444.1509472963249
Content-Type: multipart/alternative;
 boundary="----=_Part_8870_706569917.1509472963251"

------=_Part_8870_706569917.1509472963251
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

I made a copy & paste error. The correct title is:

A fixed size initializer_list. Is it possible to change the title somehow?


Am Dienstag, 31. Oktober 2017 19:00:09 UTC+1 schrieb=20
ma.ka...@googlemail.com:
>
> Hi Guys,
>
> If we have a container type like...
> =20
> template <typename E, size_t S>
> class Container
> {
>
>   public:
>
>     template <typename... Args>
>     Container(Args&&... args)
>         : data(std::forward<Args>(args)...)
>     { }
>
>   private:
>
>     E data[S];
>
> };
>
> We can initialize the container with
>
> Container<int, 5> c{ 0, 1, 2, 3, 4, 5 };
>
> But if we have a more complex element type like a class or struct we cann=
ot write
>
> Container<Element, 5> c{ { 1, "1" }, { 2, "2" }, { 3, "3" }, { 4, "4" }, =
{ 5, "5" } };
>
> The compiler cannot deduce the type. We would have to write
>
> Container<Element, 5> c{ Element{ 1, "1" }, Element{ 2, "2" }, Element{ 3=
, "3" }, Element{ 4, "4" }, Element{ 5, "5" } };
>
> That is not what we want. We could use std::initializer_list, but the ini=
tializer list could be of different size. We would have to add a runtime ch=
eck.
> If initializer_list would allow an optional size parameter. The container=
 code could look like the following
>
> template <typename E, size_t N>
> class Container
> {
>
>   public:
>
>     Container(std::initializer_list<E, N> il)
>     {
>         std::copy_n(il.begin(), N, data);
>     }
>
>   private:
>
>     E data[N];
>
> };
>
> Now we could write
>
> Container<Element, 5> c{ { 1, "1" }, { 2, "2" }, { 3, "3" }, { 4, "4" }, =
{ 5, "5" } };
>
> If the number of elements differ the compiler can detect the error:
>
> Container<Element, 5> c{ { 1, "1" }, { 2, "2" }, { 3, "3" }, { 4, "4" }, =
{ 5, "5" }, { 6, "6"} }; // error: too much elements
>
> In combination with deduction guides, allowing a partial deduction, it wo=
uld be possible to write
>
> Container<Element> c{ { 1, "1" }, { 2, "2" }, { 3, "3" }, { 4, "4" }, { 5=
, "5" } };
>
> Kind Regards,
> Martin Kalbfu=C3=9F
>
>
>

--=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/c3efa7c6-b40c-46a8-b725-998e540b9fdf%40isocpp.or=
g.

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

<div dir=3D"ltr">I made a copy &amp; paste error. The correct title is:<br>=
<br>A fixed size initializer_list. Is it possible to change the title someh=
ow?<br><br><br>Am Dienstag, 31. Oktober 2017 19:00:09 UTC+1 schrieb ma.ka..=
..@googlemail.com:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"l=
tr"><pre>Hi Guys,

If we have a container type like...<br>=C2=A0<div style=3D"background-color=
:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-w=
idth:1px"><code><div><span style=3D"color:#008">template</span><span style=
=3D"color:#000"> </span><span style=3D"color:#660">&lt;</span><span style=
=3D"color:#008">typename</span><span style=3D"color:#000"> E</span><span st=
yle=3D"color:#660">,</span><span style=3D"color:#000"> size_t S</span><span=
 style=3D"color:#660">&gt;</span><span style=3D"color:#000"><br></span><spa=
n style=3D"color:#008">class</span><span style=3D"color:#000"> </span><span=
 style=3D"color:#606">Container</span><span style=3D"color:#000"><br></span=
><span style=3D"color:#660">{</span><span style=3D"color:#000"><br><br>=C2=
=A0 </span><span style=3D"color:#008">public</span><span style=3D"color:#66=
0">:</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 </span><span st=
yle=3D"color:#008">template</span><span style=3D"color:#000"> </span><span =
style=3D"color:#660">&lt;</span><span style=3D"color:#008">typename</span><=
span style=3D"color:#660">...</span><span style=3D"color:#000"> </span><spa=
n style=3D"color:#606">Args</span><span style=3D"color:#660">&gt;</span><sp=
an style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#606"=
>Container</span><span style=3D"color:#660">(</span><span style=3D"color:#6=
06">Args</span><span style=3D"color:#660">&amp;&amp;...</span><span style=
=3D"color:#000"> args</span><span style=3D"color:#660">)</span><span style=
=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color=
:#660">:</span><span style=3D"color:#000"> data</span><span style=3D"color:=
#660">(</span><span style=3D"color:#000">std</span><span style=3D"color:#66=
0">::</span><span style=3D"color:#000">forward</span><span style=3D"color:#=
660">&lt;</span><span style=3D"color:#606">Args</span><span style=3D"color:=
#660">&gt;(</span><span style=3D"color:#000">args</span><span style=3D"colo=
r:#660">).<wbr>..)</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </spa=
n><span style=3D"color:#660">{</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#660">}</span><span style=3D"color:#000"><br><br>=C2=A0 <=
/span><span style=3D"color:#008">private</span><span style=3D"color:#660">:=
</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 E data</span><span =
style=3D"color:#660">[</span><span style=3D"color:#000">S</span><span style=
=3D"color:#660">];</span><span style=3D"color:#000"><br><br></span><span st=
yle=3D"color:#660">};</span></div></code></div>
We can initialize the container with

<div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,18=
7);border-style:solid;border-width:1px"><code><div><span style=3D"color:#60=
6">Container</span><span style=3D"color:#660">&lt;</span><span style=3D"col=
or:#008">int</span><span style=3D"color:#660">,</span><span style=3D"color:=
#000"> </span><span style=3D"color:#066">5</span><span style=3D"color:#660"=
>&gt;</span><span style=3D"color:#000"> c</span><span style=3D"color:#660">=
{</span><span style=3D"color:#000"> </span><span style=3D"color:#066">0</sp=
an><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><s=
pan style=3D"color:#066">1</span><span style=3D"color:#660">,</span><span s=
tyle=3D"color:#000"> </span><span style=3D"color:#066">2</span><span style=
=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#066">3</span><span style=3D"color:#660">,</span><span style=3D"color:=
#000"> </span><span style=3D"color:#066">4</span><span style=3D"color:#660"=
>,</span><span style=3D"color:#000"> </span><span style=3D"color:#066">5</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#660">};</span>=
</div></code></div>
But if we have a more complex element type like a class or struct we cannot=
 write

<div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,18=
7);border-style:solid;border-width:1px"><code><div><span style=3D"color:#60=
6">Container</span><span style=3D"color:#660">&lt;</span><span style=3D"col=
or:#606">Element</span><span style=3D"color:#660">,</span><span style=3D"co=
lor:#000"> </span><span style=3D"color:#066">5</span><span style=3D"color:#=
660">&gt;</span><span style=3D"color:#000"> c</span><span style=3D"color:#6=
60">{</span><span style=3D"color:#000"> </span><span style=3D"color:#660">{=
</span><span style=3D"color:#000"> </span><span style=3D"color:#066">1</spa=
n><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#080">&quot;1&quot;</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#660">},</span><span style=3D"color:#000"> </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">,</span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#080">&quot;2&quot;</span><sp=
an style=3D"color:#000"> </span><span style=3D"color:#660">},</span><span s=
tyle=3D"color:#000"> </span><span style=3D"color:#660">{</span><span style=
=3D"color:#000"> </span><span style=3D"color:#066">3</span><span style=3D"c=
olor:#660">,</span><span style=3D"color:#000"> </span><span style=3D"color:=
#080">&quot;3&quot;</span><span style=3D"color:#000"> </span><span style=3D=
"color:#660">},</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#660">{</span><span style=3D"color:#000"> </span><span style=3D"color:#0=
66">4</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> =
</span><span style=3D"color:#080">&quot;4&quot;</span><span style=3D"color:=
#000"> </span><span style=3D"color:#660">},</span><span style=3D"color:#000=
"> </span><span style=3D"color:#660">{</span><span style=3D"color:#000"> </=
span><span style=3D"color:#066">5</span><span style=3D"color:#660">,</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#080">&quot;5&quot;=
</span><span style=3D"color:#000"> </span><span style=3D"color:#660">}</spa=
n><span style=3D"color:#000"> </span><span style=3D"color:#660">};</span></=
div></code></div>
The compiler cannot deduce the type. We would have to write

<div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,18=
7);border-style:solid;border-width:1px"><code><div><span style=3D"color:#60=
6">Container</span><span style=3D"color:#660">&lt;</span><span style=3D"col=
or:#606">Element</span><span style=3D"color:#660">,</span><span style=3D"co=
lor:#000"> </span><span style=3D"color:#066">5</span><span style=3D"color:#=
660">&gt;</span><span style=3D"color:#000"> c</span><span style=3D"color:#6=
60">{</span><span style=3D"color:#000"> </span><span style=3D"color:#606">E=
lement</span><span style=3D"color:#660">{</span><span style=3D"color:#000">=
 </span><span style=3D"color:#066">1</span><span style=3D"color:#660">,</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#080">&quot;1&qu=
ot;</span><span style=3D"color:#000"> </span><span style=3D"color:#660">},<=
/span><span style=3D"color:#000"> </span><span style=3D"color:#606">Element=
</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">,</span><sp=
an style=3D"color:#000"> </span><span style=3D"color:#080">&quot;2&quot;</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#660">},</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#606">Element</span=
><span style=3D"color:#660">{</span><span style=3D"color:#000"> </span><spa=
n style=3D"color:#066">3</span><span style=3D"color:#660">,</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#080">&quot;3&quot;</span><s=
pan style=3D"color:#000"> </span><span style=3D"color:#660">},</span><span =
style=3D"color:#000"> </span><span style=3D"color:#606">Element</span><span=
 style=3D"color:#660">{</span><span style=3D"color:#000"> </span><span styl=
e=3D"color:#066">4</span><span style=3D"color:#660">,</span><span style=3D"=
color:#000"> </span><span style=3D"color:#080">&quot;4&quot;</span><span st=
yle=3D"color:#000"> </span><span style=3D"color:#660">},</span><span style=
=3D"color:#000"> </span><span style=3D"color:#606">Element</span><span styl=
e=3D"color:#660">{</span><span style=3D"color:#000"> </span><span style=3D"=
color:#066">5</span><span style=3D"color:#660">,</span><span style=3D"color=
:#000"> </span><span style=3D"color:#080">&quot;5&quot;</span><span style=
=3D"color:#000"> </span><span style=3D"color:#660">}</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#660">};</span></div></code></div>
That is not what we want. We could use std::initializer_list, but the initi=
alizer list could be of different size. We would have to add a runtime chec=
k.
If initializer_list would allow an optional size parameter. The container c=
ode could look like the following

<div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,18=
7);border-style:solid;border-width:1px"><code><div><span style=3D"color:#00=
8">template</span><span style=3D"color:#000"> </span><span style=3D"color:#=
660">&lt;</span><span style=3D"color:#008">typename</span><span style=3D"co=
lor:#000"> E</span><span style=3D"color:#660">,</span><span style=3D"color:=
#000"> size_t N</span><span style=3D"color:#660">&gt;</span><span style=3D"=
color:#000"><br></span><span style=3D"color:#008">class</span><span style=
=3D"color:#000"> </span><span style=3D"color:#606">Container</span><span st=
yle=3D"color:#000"><br></span><span style=3D"color:#660">{</span><span styl=
e=3D"color:#000"><br><br>=C2=A0 </span><span style=3D"color:#008">public</s=
pan><span style=3D"color:#660">:</span><span style=3D"color:#000"><br><br>=
=C2=A0 =C2=A0 </span><span style=3D"color:#606">Container</span><span style=
=3D"color:#660">(</span><span style=3D"color:#000">std</span><span style=3D=
"color:#660">::</span><span style=3D"color:#000">initializer_<wbr>list</spa=
n><span style=3D"color:#660">&lt;</span><span style=3D"color:#000">E</span>=
<span style=3D"color:#660">,</span><span style=3D"color:#000"> N</span><spa=
n style=3D"color:#660">&gt;</span><span style=3D"color:#000"> il</span><spa=
n style=3D"color:#660">)</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0=
 </span><span style=3D"color:#660">{</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 std</span><span style=3D"color:#660">::</span><=
span style=3D"color:#000">copy_n</span><span style=3D"color:#660">(</span><=
span style=3D"color:#000">il</span><span style=3D"color:#660">.</span><span=
 style=3D"color:#008">begin</span><span style=3D"color:#660">(),</span><spa=
n style=3D"color:#000"> N</span><span style=3D"color:#660">,</span><span st=
yle=3D"color:#000"> data</span><span style=3D"color:#660">);</span><span st=
yle=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#660">}</s=
pan><span style=3D"color:#000"><br><br>=C2=A0 </span><span style=3D"color:#=
008">private</span><span style=3D"color:#660">:</span><span style=3D"color:=
#000"><br><br>=C2=A0 =C2=A0 E data</span><span style=3D"color:#660">[</span=
><span style=3D"color:#000">N</span><span style=3D"color:#660">];</span><sp=
an style=3D"color:#000"><br><br></span><span style=3D"color:#660">};</span>=
</div></code></div><br>Now we could write

<div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,18=
7);border-style:solid;border-width:1px"><code><div><span style=3D"color:#60=
6">Container</span><span style=3D"color:#660">&lt;</span><span style=3D"col=
or:#606">Element</span><span style=3D"color:#660">,</span><span style=3D"co=
lor:#000"> </span><span style=3D"color:#066">5</span><span style=3D"color:#=
660">&gt;</span><span style=3D"color:#000"> c</span><span style=3D"color:#6=
60">{</span><span style=3D"color:#000"> </span><span style=3D"color:#660">{=
</span><span style=3D"color:#000"> </span><span style=3D"color:#066">1</spa=
n><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#080">&quot;1&quot;</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#660">},</span><span style=3D"color:#000"> </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">,</span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#080">&quot;2&quot;</span><sp=
an style=3D"color:#000"> </span><span style=3D"color:#660">},</span><span s=
tyle=3D"color:#000"> </span><span style=3D"color:#660">{</span><span style=
=3D"color:#000"> </span><span style=3D"color:#066">3</span><span style=3D"c=
olor:#660">,</span><span style=3D"color:#000"> </span><span style=3D"color:=
#080">&quot;3&quot;</span><span style=3D"color:#000"> </span><span style=3D=
"color:#660">},</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#660">{</span><span style=3D"color:#000"> </span><span style=3D"color:#0=
66">4</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> =
</span><span style=3D"color:#080">&quot;4&quot;</span><span style=3D"color:=
#000"> </span><span style=3D"color:#660">},</span><span style=3D"color:#000=
"> </span><span style=3D"color:#660">{</span><span style=3D"color:#000"> </=
span><span style=3D"color:#066">5</span><span style=3D"color:#660">,</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#080">&quot;5&quot;=
</span><span style=3D"color:#000"> </span><span style=3D"color:#660">}</spa=
n><span style=3D"color:#000"> </span><span style=3D"color:#660">};</span></=
div></code></div><br>If the number of elements differ the compiler can dete=
ct the error:

<div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,18=
7);border-style:solid;border-width:1px"><code><div><span style=3D"color:#60=
6">Container</span><span style=3D"color:#660">&lt;</span><span style=3D"col=
or:#606">Element</span><span style=3D"color:#660">,</span><span style=3D"co=
lor:#000"> </span><span style=3D"color:#066">5</span><span style=3D"color:#=
660">&gt;</span><span style=3D"color:#000"> c</span><span style=3D"color:#6=
60">{</span><span style=3D"color:#000"> </span><span style=3D"color:#660">{=
</span><span style=3D"color:#000"> </span><span style=3D"color:#066">1</spa=
n><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#080">&quot;1&quot;</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#660">},</span><span style=3D"color:#000"> </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">,</span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#080">&quot;2&quot;</span><sp=
an style=3D"color:#000"> </span><span style=3D"color:#660">},</span><span s=
tyle=3D"color:#000"> </span><span style=3D"color:#660">{</span><span style=
=3D"color:#000"> </span><span style=3D"color:#066">3</span><span style=3D"c=
olor:#660">,</span><span style=3D"color:#000"> </span><span style=3D"color:=
#080">&quot;3&quot;</span><span style=3D"color:#000"> </span><span style=3D=
"color:#660">},</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#660">{</span><span style=3D"color:#000"> </span><span style=3D"color:#0=
66">4</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> =
</span><span style=3D"color:#080">&quot;4&quot;</span><span style=3D"color:=
#000"> </span><span style=3D"color:#660">},</span><span style=3D"color:#000=
"> </span><span style=3D"color:#660">{</span><span style=3D"color:#000"> </=
span><span style=3D"color:#066">5</span><span style=3D"color:#660">,</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#080">&quot;5&quot;=
</span><span style=3D"color:#000"> </span><span style=3D"color:#660">},</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#660">{</span><s=
pan style=3D"color:#000"> </span><span style=3D"color:#066">6</span><span s=
tyle=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=
=3D"color:#080">&quot;6&quot;</span><span style=3D"color:#660">}</span><spa=
n style=3D"color:#000"> </span><span style=3D"color:#660">};</span><span st=
yle=3D"color:#000"> </span><span style=3D"color:#800">// error: too much el=
ements</span></div></code></div>
In combination with deduction guides, allowing a partial deduction, it woul=
d be possible to write

<div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,18=
7);border-style:solid;border-width:1px"><code><div><span style=3D"color:#60=
6">Container</span><span style=3D"color:#660">&lt;</span><span style=3D"col=
or:#606">Element</span><span style=3D"color:#660">&gt;</span><span style=3D=
"color:#000"> c</span><span style=3D"color:#660">{</span><span style=3D"col=
or:#000"> </span><span style=3D"color:#660">{</span><span style=3D"color:#0=
00"> </span><span style=3D"color:#066">1</span><span style=3D"color:#660">,=
</span><span style=3D"color:#000"> </span><span style=3D"color:#080">&quot;=
1&quot;</span><span style=3D"color:#000"> </span><span style=3D"color:#660"=
>},</span><span style=3D"color:#000"> </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">,</span><span style=3D"color:#000"> </span><span=
 style=3D"color:#080">&quot;2&quot;</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#660">},</span><span style=3D"color:#000"> </span><s=
pan style=3D"color:#660">{</span><span style=3D"color:#000"> </span><span s=
tyle=3D"color:#066">3</span><span style=3D"color:#660">,</span><span style=
=3D"color:#000"> </span><span style=3D"color:#080">&quot;3&quot;</span><spa=
n style=3D"color:#000"> </span><span style=3D"color:#660">},</span><span st=
yle=3D"color:#000"> </span><span style=3D"color:#660">{</span><span style=
=3D"color:#000"> </span><span style=3D"color:#066">4</span><span style=3D"c=
olor:#660">,</span><span style=3D"color:#000"> </span><span style=3D"color:=
#080">&quot;4&quot;</span><span style=3D"color:#000"> </span><span style=3D=
"color:#660">},</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#660">{</span><span style=3D"color:#000"> </span><span style=3D"color:#0=
66">5</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> =
</span><span style=3D"color:#080">&quot;5&quot;</span><span style=3D"color:=
#000"> </span><span style=3D"color:#660">}</span><span style=3D"color:#000"=
> </span><span style=3D"color:#660">};</span></div></code></div>
Kind Regards,
Martin Kalbfu=C3=9F

</pre></div></blockquote></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/c3efa7c6-b40c-46a8-b725-998e540b9fdf%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/c3efa7c6-b40c-46a8-b725-998e540b9fdf=
%40isocpp.org</a>.<br />

------=_Part_8870_706569917.1509472963251--

------=_Part_8869_2114406444.1509472963249--

.


Author: Zhihao Yuan <zy@miator.net>
Date: Tue, 31 Oct 2017 13:11:05 -0500
Raw View
--001a1147516ebb99ad055cdbad2c
Content-Type: text/plain; charset="UTF-8"

On Tue, Oct 31, 2017 at 1:02 PM, ma.kalbfuss via ISO C++ Standard - Future
Proposals <std-proposals@isocpp.org> wrote:

>
> A fixed size initializer_list. Is it possible to change the title somehow?
>

It's not necessary to solve the problem you
raised.  Deduction guides can have constraints,
so a constraint testing sizeof...(Args) is enough
to limit the number of arguments.  The only
issue is that we can't deduce from partial-
template-id yet.

--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
_______________________________________________

--
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/CAGsORuAU0zCJGioZ0qzPq_vfBt50zdE4eFvvg8o_Ts8BYd4VOw%40mail.gmail.com.

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

<div dir=3D"ltr">On Tue, Oct 31, 2017 at 1:02 PM, ma.kalbfuss via ISO C++ S=
tandard - Future Proposals <span dir=3D"ltr">&lt;<a href=3D"mailto:std-prop=
osals@isocpp.org" target=3D"_blank">std-proposals@isocpp.org</a>&gt;</span>=
 wrote:<br><div class=3D"gmail_extra"><div class=3D"gmail_quote"><blockquot=
e class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc sol=
id;padding-left:1ex"><div dir=3D"ltr"><br>A fixed size initializer_list. Is=
 it possible to change the title somehow?</div></blockquote><div><br></div>=
<div>It&#39;s not necessary to solve the problem you<br>raised.=C2=A0 Deduc=
tion guides can have constraints,<br>so a constraint testing sizeof...(Args=
) is enough<br>to limit the number of arguments.=C2=A0 The only<br></div><d=
iv>issue is that we can&#39;t deduce from partial-<br>template-id yet.<br><=
/div></div><br>-- <br><div class=3D"gmail_signature" data-smartmail=3D"gmai=
l_signature"><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"ltr"><=
div>Zhihao Yuan, ID lichray<br>The best way to predict the future is to inv=
ent it.<br>_______________________________________________<br></div></div><=
/div></div></div></div></div>
</div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&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/CAGsORuAU0zCJGioZ0qzPq_vfBt50zdE4eFvv=
g8o_Ts8BYd4VOw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAGsORuAU0zCJGioZ=
0qzPq_vfBt50zdE4eFvvg8o_Ts8BYd4VOw%40mail.gmail.com</a>.<br />

--001a1147516ebb99ad055cdbad2c--

.


Author: "ma.kalbfuss via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Tue, 31 Oct 2017 11:28:33 -0700 (PDT)
Raw View
------=_Part_8847_1342437259.1509474513354
Content-Type: multipart/alternative;
 boundary="----=_Part_8848_1703691969.1509474513354"

------=_Part_8848_1703691969.1509474513354
Content-Type: text/plain; charset="UTF-8"

Thanks for your fast response. My main point is not only to be able to
deduce the size.

I wrote:

But if we have a more complex element type like a class or struct we cannot write

Container<Element, 5> c{ { 1, "1" }, { 2, "2" }, { 3, "3" }, { 4, "4" }, { 5, "5" } };

The compiler cannot deduce the type. We would have to write

Container<Element, 5> c{ Element{ 1, "1" }, Element{ 2, "2" }, Element{ 3, "3" }, Element{ 4, "4" }, Element{ 5, "5" } };



The problem is the variadic template argument list. It cannot deduce the
type for of the passed arguments. I think this problem is not solvable
using deduction guides.


Am Dienstag, 31. Oktober 2017 19:11:15 UTC+1 schrieb Zhihao Yuan:
>
> On Tue, Oct 31, 2017 at 1:02 PM, ma.kalbfuss via ISO C++ Standard - Future
> Proposals <std-pr...@isocpp.org <javascript:>> wrote:
>
>>
>> A fixed size initializer_list. Is it possible to change the title somehow?
>>
>
> It's not necessary to solve the problem you
> raised.  Deduction guides can have constraints,
> so a constraint testing sizeof...(Args) is enough
> to limit the number of arguments.  The only
> issue is that we can't deduce from partial-
> template-id yet.
>
> --
> Zhihao Yuan, ID lichray
> The best way to predict the future is to invent it.
> _______________________________________________
>

--
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/e470185b-bb1d-457a-976a-10d110e7c703%40isocpp.org.

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

<div dir=3D"ltr">Thanks for your fast response. My main point is not only t=
o be able to deduce the size.<br><br>I wrote:<br><br><pre>But if we have a =
more complex element type like a class or struct we cannot write

<div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,18=
7);border-style:solid;border-width:1px"><code><div><span style=3D"color:#60=
6">Container</span><span style=3D"color:#660">&lt;</span><span style=3D"col=
or:#606">Element</span><span style=3D"color:#660">,</span><span style=3D"co=
lor:#000"> </span><span style=3D"color:#066">5</span><span style=3D"color:#=
660">&gt;</span><span style=3D"color:#000"> c</span><span style=3D"color:#6=
60">{</span><span style=3D"color:#000"> </span><span style=3D"color:#660">{=
</span><span style=3D"color:#000"> </span><span style=3D"color:#066">1</spa=
n><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#080">&quot;1&quot;</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#660">},</span><span style=3D"color:#000"> </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">,</span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#080">&quot;2&quot;</span><sp=
an style=3D"color:#000"> </span><span style=3D"color:#660">},</span><span s=
tyle=3D"color:#000"> </span><span style=3D"color:#660">{</span><span style=
=3D"color:#000"> </span><span style=3D"color:#066">3</span><span style=3D"c=
olor:#660">,</span><span style=3D"color:#000"> </span><span style=3D"color:=
#080">&quot;3&quot;</span><span style=3D"color:#000"> </span><span style=3D=
"color:#660">},</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#660">{</span><span style=3D"color:#000"> </span><span style=3D"color:#0=
66">4</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> =
</span><span style=3D"color:#080">&quot;4&quot;</span><span style=3D"color:=
#000"> </span><span style=3D"color:#660">},</span><span style=3D"color:#000=
"> </span><span style=3D"color:#660">{</span><span style=3D"color:#000"> </=
span><span style=3D"color:#066">5</span><span style=3D"color:#660">,</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#080">&quot;5&quot;=
</span><span style=3D"color:#000"> </span><span style=3D"color:#660">}</spa=
n><span style=3D"color:#000"> </span><span style=3D"color:#660">};</span></=
div></code></div>
The compiler cannot deduce the type. We would have to write

<div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,18=
7);border-style:solid;border-width:1px"><code><div><span style=3D"color:#60=
6">Container</span><span style=3D"color:#660">&lt;</span><span style=3D"col=
or:#606">Element</span><span style=3D"color:#660">,</span><span style=3D"co=
lor:#000"> </span><span style=3D"color:#066">5</span><span style=3D"color:#=
660">&gt;</span><span style=3D"color:#000"> c</span><span style=3D"color:#6=
60">{</span><span style=3D"color:#000"> </span><span style=3D"color:#606">E=
lement</span><span style=3D"color:#660">{</span><span style=3D"color:#000">=
 </span><span style=3D"color:#066">1</span><span style=3D"color:#660">,</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#080">&quot;1&qu=
ot;</span><span style=3D"color:#000"> </span><span style=3D"color:#660">},<=
/span><span style=3D"color:#000"> </span><span style=3D"color:#606">Element=
</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">,</span><sp=
an style=3D"color:#000"> </span><span style=3D"color:#080">&quot;2&quot;</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#660">},</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#606">Element</span=
><span style=3D"color:#660">{</span><span style=3D"color:#000"> </span><spa=
n style=3D"color:#066">3</span><span style=3D"color:#660">,</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#080">&quot;3&quot;</span><s=
pan style=3D"color:#000"> </span><span style=3D"color:#660">},</span><span =
style=3D"color:#000"> </span><span style=3D"color:#606">Element</span><span=
 style=3D"color:#660">{</span><span style=3D"color:#000"> </span><span styl=
e=3D"color:#066">4</span><span style=3D"color:#660">,</span><span style=3D"=
color:#000"> </span><span style=3D"color:#080">&quot;4&quot;</span><span st=
yle=3D"color:#000"> </span><span style=3D"color:#660">},</span><span style=
=3D"color:#000"> </span><span style=3D"color:#606">Element</span><span styl=
e=3D"color:#660">{</span><span style=3D"color:#000"> </span><span style=3D"=
color:#066">5</span><span style=3D"color:#660">,</span><span style=3D"color=
:#000"> </span><span style=3D"color:#080">&quot;5&quot;</span><span style=
=3D"color:#000"> </span><span style=3D"color:#660">}</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#660">};</span></div></code></div><=
/pre><br><br>The problem is the variadic template argument list. It cannot =
deduce the type for of the passed arguments. I think this problem is not so=
lvable using deduction guides.<br><br><br>Am Dienstag, 31. Oktober 2017 19:=
11:15 UTC+1 schrieb Zhihao Yuan:<blockquote class=3D"gmail_quote" style=3D"=
margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;=
"><div dir=3D"ltr">On Tue, Oct 31, 2017 at 1:02 PM, ma.kalbfuss via ISO C++=
 Standard - Future Proposals <span dir=3D"ltr">&lt;<a href=3D"javascript:" =
target=3D"_blank" gdf-obfuscated-mailto=3D"YbYjZMduAwAJ" rel=3D"nofollow" o=
nmousedown=3D"this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"th=
is.href=3D&#39;javascript:&#39;;return true;">std-pr...@isocpp.org</a>&gt;<=
/span> wrote:<br><div><div class=3D"gmail_quote"><blockquote class=3D"gmail=
_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:=
1ex"><div dir=3D"ltr"><br>A fixed size initializer_list. Is it possible to =
change the title somehow?</div></blockquote><div><br></div><div>It&#39;s no=
t necessary to solve the problem you<br>raised.=C2=A0 Deduction guides can =
have constraints,<br>so a constraint testing sizeof...(Args) is enough<br>t=
o limit the number of arguments.=C2=A0 The only<br></div><div>issue is that=
 we can&#39;t deduce from partial-<br>template-id yet.<br></div></div><br>-=
- <br><div><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"ltr"><di=
v>Zhihao Yuan, ID lichray<br>The best way to predict the future is to inven=
t it.<br>______________________________<wbr>_________________<br></div></di=
v></div></div></div></div></div>
</div></div>
</blockquote></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/e470185b-bb1d-457a-976a-10d110e7c703%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/e470185b-bb1d-457a-976a-10d110e7c703=
%40isocpp.org</a>.<br />

------=_Part_8848_1703691969.1509474513354--

------=_Part_8847_1342437259.1509474513354--

.


Author: Zhihao Yuan <zy@miator.net>
Date: Tue, 31 Oct 2017 13:41:57 -0500
Raw View
--94eb2c0600ce22bb4b055cdc1c69
Content-Type: text/plain; charset="UTF-8"

On Tue, Oct 31, 2017 at 1:28 PM, <ma.kalbfuss@googlemail.com> wrote:

>
> The compiler cannot deduce the type. We would have to write
>
> Container<Element, 5> c{ Element{ 1, "1" }, Element{ 2, "2" }, Element{ 3, "3" }, Element{ 4, "4" }, Element{ 5, "5" } };
>
> The problem is the variadic template argument list. It cannot deduce the
> type for of the passed arguments. I think this problem is not solvable
> using deduction guides.
>

Your problem is not "compiler cannot deduce the type".
Your desired outcome is to write:

Container<Element> c{ { 1, "1" }, { 2, "2" }, { 3, "3" }, { 4, "4" },
{ 5, "5" } };


Where you already supplied the element type

    Container<Element /* right here */>

So with my idea raised at


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

The following (new kind of) deduction guide will
have this outcome:

    template <typename T, typename... U>
    Container<T>(U...) -> Container<T, sizeof...(U)>;

--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
_______________________________________________

--
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/CAGsORuCDPKCrozwjnxC01forgr_U8SrOdUso39nJeeNjKr-s1A%40mail.gmail.com.

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

<div dir=3D"ltr"><div><div><div>On Tue, Oct 31, 2017 at 1:28 PM,  <span dir=
=3D"ltr">&lt;<a href=3D"mailto:ma.kalbfuss@googlemail.com" target=3D"_blank=
">ma.kalbfuss@googlemail.com</a>&gt;</span> wrote:<br><div class=3D"gmail_e=
xtra"><div class=3D"gmail_quote"><blockquote style=3D"margin:0px 0px 0px 0.=
8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class=3D"gmail=
_quote"><br><div dir=3D"ltr">The compiler cannot deduce the type. We would =
have to write

<span><pre><div style=3D"background-color:rgb(250,250,250);border-color:rgb=
(187,187,187);border-style:solid;border-width:1px"><code><div><span style=
=3D"color:rgb(102,0,102)">Container</span><span style=3D"color:rgb(102,102,=
0)">&lt;</span><span style=3D"color:rgb(102,0,102)">Element</span><span sty=
le=3D"color:rgb(102,102,0)">,</span><span style=3D"color:rgb(0,0,0)"> </spa=
n><span style=3D"color:rgb(0,102,102)">5</span><span style=3D"color:rgb(102=
,102,0)">&gt;</span><span style=3D"color:rgb(0,0,0)"> c</span><span style=
=3D"color:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"> </span>=
<span style=3D"color:rgb(102,0,102)">Element</span><span style=3D"color:rgb=
(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"> </span><span style=
=3D"color:rgb(0,102,102)">1</span><span style=3D"color:rgb(102,102,0)">,</s=
pan><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,136=
,0)">&quot;1&quot;</span><span style=3D"color:rgb(0,0,0)"> </span><span sty=
le=3D"color:rgb(102,102,0)">},</span><span style=3D"color:rgb(0,0,0)"> </sp=
an><span style=3D"color:rgb(102,0,102)">Element</span><span style=3D"color:=
rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"> </span><span styl=
e=3D"color:rgb(0,102,102)">2</span><span style=3D"color:rgb(102,102,0)">,</=
span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,13=
6,0)">&quot;2&quot;</span><span style=3D"color:rgb(0,0,0)"> </span><span st=
yle=3D"color:rgb(102,102,0)">},</span><span style=3D"color:rgb(0,0,0)"> </s=
pan><span style=3D"color:rgb(102,0,102)">Element</span><span style=3D"color=
:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"> </span><span sty=
le=3D"color:rgb(0,102,102)">3</span><span style=3D"color:rgb(102,102,0)">,<=
/span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,1=
36,0)">&quot;3&quot;</span><span style=3D"color:rgb(0,0,0)"> </span><span s=
tyle=3D"color:rgb(102,102,0)">},</span><span style=3D"color:rgb(0,0,0)"> </=
span><span style=3D"color:rgb(102,0,102)">Element</span><span style=3D"colo=
r:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"> </span><span st=
yle=3D"color:rgb(0,102,102)">4</span><span style=3D"color:rgb(102,102,0)">,=
</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,=
136,0)">&quot;4&quot;</span><span style=3D"color:rgb(0,0,0)"> </span><span =
style=3D"color:rgb(102,102,0)">},</span><span style=3D"color:rgb(0,0,0)"> <=
/span><span style=3D"color:rgb(102,0,102)">Element</span><span style=3D"col=
or:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"> </span><span s=
tyle=3D"color:rgb(0,102,102)">5</span><span style=3D"color:rgb(102,102,0)">=
,</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0=
,136,0)">&quot;5&quot;</span><span style=3D"color:rgb(0,0,0)"> </span><span=
 style=3D"color:rgb(102,102,0)">}</span><span style=3D"color:rgb(0,0,0)"> <=
/span><span style=3D"color:rgb(102,102,0)">};</span></div></code></div></pr=
e></span>The problem is the variadic template argument list. It cannot dedu=
ce the type for of the passed arguments. I think this problem is not solvab=
le using deduction guides.<br></div></blockquote></div><br></div><div class=
=3D"gmail_extra">Your problem is not &quot;compiler cannot deduce the type&=
quot;.<br></div><div class=3D"gmail_extra">Your desired outcome is to write=
:<br><br><pre><div style=3D"background-color:rgb(250,250,250);border-color:=
rgb(187,187,187);border-style:solid;border-width:1px" class=3D"gmail-m_2687=
734610387955930prettyprint"><code class=3D"gmail-m_2687734610387955930prett=
yprint"><div class=3D"gmail-m_2687734610387955930subprettyprint"><span styl=
e=3D"color:rgb(102,0,102)" class=3D"gmail-m_2687734610387955930styled-by-pr=
ettify">Container</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail=
-m_2687734610387955930styled-by-prettify">&lt;</span><span style=3D"color:r=
gb(102,0,102)" class=3D"gmail-m_2687734610387955930styled-by-prettify">Elem=
ent</span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_26877346103=
87955930styled-by-prettify"></span><span style=3D"color:rgb(0,0,0)" class=
=3D"gmail-m_2687734610387955930styled-by-prettify"></span><span style=3D"co=
lor:rgb(0,102,102)" class=3D"gmail-m_2687734610387955930styled-by-prettify"=
></span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_2687734610387=
955930styled-by-prettify">&gt;</span><span style=3D"color:rgb(0,0,0)" class=
=3D"gmail-m_2687734610387955930styled-by-prettify"> c</span><span style=3D"=
color:rgb(102,102,0)" class=3D"gmail-m_2687734610387955930styled-by-prettif=
y">{</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_26877346103879=
55930styled-by-prettify"> </span><span style=3D"color:rgb(102,102,0)" class=
=3D"gmail-m_2687734610387955930styled-by-prettify">{</span><span style=3D"c=
olor:rgb(0,0,0)" class=3D"gmail-m_2687734610387955930styled-by-prettify"> <=
/span><span style=3D"color:rgb(0,102,102)" class=3D"gmail-m_268773461038795=
5930styled-by-prettify">1</span><span style=3D"color:rgb(102,102,0)" class=
=3D"gmail-m_2687734610387955930styled-by-prettify">,</span><span style=3D"c=
olor:rgb(0,0,0)" class=3D"gmail-m_2687734610387955930styled-by-prettify"> <=
/span><span style=3D"color:rgb(0,136,0)" class=3D"gmail-m_26877346103879559=
30styled-by-prettify">&quot;1&quot;</span><span style=3D"color:rgb(0,0,0)" =
class=3D"gmail-m_2687734610387955930styled-by-prettify"> </span><span style=
=3D"color:rgb(102,102,0)" class=3D"gmail-m_2687734610387955930styled-by-pre=
ttify">},</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_268773461=
0387955930styled-by-prettify"> </span><span style=3D"color:rgb(102,102,0)" =
class=3D"gmail-m_2687734610387955930styled-by-prettify">{</span><span style=
=3D"color:rgb(0,0,0)" class=3D"gmail-m_2687734610387955930styled-by-prettif=
y"> </span><span style=3D"color:rgb(0,102,102)" class=3D"gmail-m_2687734610=
387955930styled-by-prettify">2</span><span style=3D"color:rgb(102,102,0)" c=
lass=3D"gmail-m_2687734610387955930styled-by-prettify">,</span><span style=
=3D"color:rgb(0,0,0)" class=3D"gmail-m_2687734610387955930styled-by-prettif=
y"> </span><span style=3D"color:rgb(0,136,0)" class=3D"gmail-m_268773461038=
7955930styled-by-prettify">&quot;2&quot;</span><span style=3D"color:rgb(0,0=
,0)" class=3D"gmail-m_2687734610387955930styled-by-prettify"> </span><span =
style=3D"color:rgb(102,102,0)" class=3D"gmail-m_2687734610387955930styled-b=
y-prettify">},</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_2687=
734610387955930styled-by-prettify"> </span><span style=3D"color:rgb(102,102=
,0)" class=3D"gmail-m_2687734610387955930styled-by-prettify">{</span><span =
style=3D"color:rgb(0,0,0)" class=3D"gmail-m_2687734610387955930styled-by-pr=
ettify"> </span><span style=3D"color:rgb(0,102,102)" class=3D"gmail-m_26877=
34610387955930styled-by-prettify">3</span><span style=3D"color:rgb(102,102,=
0)" class=3D"gmail-m_2687734610387955930styled-by-prettify">,</span><span s=
tyle=3D"color:rgb(0,0,0)" class=3D"gmail-m_2687734610387955930styled-by-pre=
ttify"> </span><span style=3D"color:rgb(0,136,0)" class=3D"gmail-m_26877346=
10387955930styled-by-prettify">&quot;3&quot;</span><span style=3D"color:rgb=
(0,0,0)" class=3D"gmail-m_2687734610387955930styled-by-prettify"> </span><s=
pan style=3D"color:rgb(102,102,0)" class=3D"gmail-m_2687734610387955930styl=
ed-by-prettify">},</span><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_=
2687734610387955930styled-by-prettify"> </span><span style=3D"color:rgb(102=
,102,0)" class=3D"gmail-m_2687734610387955930styled-by-prettify">{</span><s=
pan style=3D"color:rgb(0,0,0)" class=3D"gmail-m_2687734610387955930styled-b=
y-prettify"> </span><span style=3D"color:rgb(0,102,102)" class=3D"gmail-m_2=
687734610387955930styled-by-prettify">4</span><span style=3D"color:rgb(102,=
102,0)" class=3D"gmail-m_2687734610387955930styled-by-prettify">,</span><sp=
an style=3D"color:rgb(0,0,0)" class=3D"gmail-m_2687734610387955930styled-by=
-prettify"> </span><span style=3D"color:rgb(0,136,0)" class=3D"gmail-m_2687=
734610387955930styled-by-prettify">&quot;4&quot;</span><span style=3D"color=
:rgb(0,0,0)" class=3D"gmail-m_2687734610387955930styled-by-prettify"> </spa=
n><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_2687734610387955930=
styled-by-prettify">},</span><span style=3D"color:rgb(0,0,0)" class=3D"gmai=
l-m_2687734610387955930styled-by-prettify"> </span><span style=3D"color:rgb=
(102,102,0)" class=3D"gmail-m_2687734610387955930styled-by-prettify">{</spa=
n><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_2687734610387955930styl=
ed-by-prettify"> </span><span style=3D"color:rgb(0,102,102)" class=3D"gmail=
-m_2687734610387955930styled-by-prettify">5</span><span style=3D"color:rgb(=
102,102,0)" class=3D"gmail-m_2687734610387955930styled-by-prettify">,</span=
><span style=3D"color:rgb(0,0,0)" class=3D"gmail-m_2687734610387955930style=
d-by-prettify"> </span><span style=3D"color:rgb(0,136,0)" class=3D"gmail-m_=
2687734610387955930styled-by-prettify">&quot;5&quot;</span><span style=3D"c=
olor:rgb(0,0,0)" class=3D"gmail-m_2687734610387955930styled-by-prettify"> <=
/span><span style=3D"color:rgb(102,102,0)" class=3D"gmail-m_268773461038795=
5930styled-by-prettify">}</span><span style=3D"color:rgb(0,0,0)" class=3D"g=
mail-m_2687734610387955930styled-by-prettify"> </span><span style=3D"color:=
rgb(102,102,0)" class=3D"gmail-m_2687734610387955930styled-by-prettify">};<=
/span></div></code></div></pre></div><br></div>Where you already supplied t=
he element type<br><br></div>=C2=A0=C2=A0=C2=A0 Container&lt;Element /* rig=
ht here */&gt;<br><br></div>So with my idea raised at<br><br>=C2=A0 <a href=
=3D"https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/P_Rb=
ANIP7cY">https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals=
/P_RbANIP7cY</a><br><div><div><div><div><br></div><div>The following (new k=
ind of) deduction guide will<br>have this outcome:<br></div><div><br><div c=
lass=3D"gmail_extra">=C2=A0=C2=A0=C2=A0 template &lt;typename T, typename..=
.. U&gt;<br>=C2=A0=C2=A0=C2=A0 Container&lt;T&gt;(U...) -&gt; Container&lt;T=
, sizeof...(U)&gt;;<br clear=3D"all"><br>-- <br><div class=3D"gmail-m_-5052=
065412238745563gmail-m_408882345815666136gmail_signature"><div dir=3D"ltr">=
<div><div dir=3D"ltr"><div><div dir=3D"ltr"><div>Zhihao Yuan, ID lichray<br=
>The best way to predict the future is to invent it.<br>___________________=
___________<wbr>_________________<br></div></div></div></div></div></div></=
div>
</div></div></div></div></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&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/CAGsORuCDPKCrozwjnxC01forgr_U8SrOdUso=
39nJeeNjKr-s1A%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAGsORuCDPKCrozwj=
nxC01forgr_U8SrOdUso39nJeeNjKr-s1A%40mail.gmail.com</a>.<br />

--94eb2c0600ce22bb4b055cdc1c69--

.


Author: "ma.kalbfuss via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Tue, 31 Oct 2017 11:51:08 -0700 (PDT)
Raw View
------=_Part_8991_1278987492.1509475868559
Content-Type: multipart/alternative;
 boundary="----=_Part_8992_424164444.1509475868560"

------=_Part_8992_424164444.1509475868560
Content-Type: text/plain; charset="UTF-8"

template <typename T, typename... U>
Container<T>(U...) -> Container<T, sizeof...(U)>;


The Problem is U... not T. Even if T is known, U... is not. That's why you
still cannot write

Container<Element> c{ { 1, "1" }, { 2, "2" }, { 3, "3" }, { 4, "4" }, { 5, "5" } };




Am Dienstag, 31. Oktober 2017 19:42:18 UTC+1 schrieb Zhihao Yuan:
>
> On Tue, Oct 31, 2017 at 1:28 PM, <ma.ka...@googlemail.com <javascript:>>
> wrote:
>
>>
>> The compiler cannot deduce the type. We would have to write
>>
>> Container<Element, 5> c{ Element{ 1, "1" }, Element{ 2, "2" }, Element{ 3, "3" }, Element{ 4, "4" }, Element{ 5, "5" } };
>>
>> The problem is the variadic template argument list. It cannot deduce the
>> type for of the passed arguments. I think this problem is not solvable
>> using deduction guides.
>>
>
> Your problem is not "compiler cannot deduce the type".
> Your desired outcome is to write:
>
> Container<Element> c{ { 1, "1" }, { 2, "2" }, { 3, "3" }, { 4, "4" }, { 5, "5" } };
>
>
> Where you already supplied the element type
>
>     Container<Element /* right here */>
>
> So with my idea raised at
>
>
> https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/P_RbANIP7cY
>
> The following (new kind of) deduction guide will
> have this outcome:
>
>     template <typename T, typename... U>
>     Container<T>(U...) -> Container<T, sizeof...(U)>;
>
> --
> Zhihao Yuan, ID lichray
> The best way to predict the future is to invent it.
> _______________________________________________
>

--
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/616d6d02-c875-418a-a02f-a189733d5f5a%40isocpp.org.

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

<div dir=3D"ltr"><div style=3D"background-color: rgb(250, 250, 250); border=
-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; overflo=
w-wrap: break-word;" class=3D"prettyprint"><code class=3D"prettyprint"><div=
 class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">template</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&l=
t;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">typename=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> T</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">...</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> U</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br></span><span style=3D"color: #606;" class=3D"styled-b=
y-prettify">Container</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">&lt;</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">T</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;=
(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">U</span><=
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: #660;" class=3D"styled-by-prettify">-&gt;</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" c=
lass=3D"styled-by-prettify">Container</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">&lt;</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify">T</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">sizeof=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">...(</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">U</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">)&gt;;</span></div></code=
></div><br><br>The Problem is U... not T. Even if T is known, U... is not. =
That&#39;s why you still cannot write<br><br><pre><div style=3D"background-=
color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;bor=
der-width:1px"><code><div><span style=3D"color:rgb(102,0,102)">Container</s=
pan><span style=3D"color:rgb(102,102,0)">&lt;</span><span style=3D"color:rg=
b(102,0,102)">Element</span><span style=3D"color:rgb(102,102,0)"></span><sp=
an style=3D"color:rgb(0,0,0)"></span><span style=3D"color:rgb(0,102,102)"><=
/span><span style=3D"color:rgb(102,102,0)">&gt;</span><span style=3D"color:=
rgb(0,0,0)"> c</span><span style=3D"color:rgb(102,102,0)">{</span><span sty=
le=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">{</spa=
n><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,102,1=
02)">1</span><span style=3D"color:rgb(102,102,0)">,</span><span style=3D"co=
lor:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,136,0)">&quot;1&quot;</s=
pan><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,1=
02,0)">},</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"col=
or:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"> </span><span s=
tyle=3D"color:rgb(0,102,102)">2</span><span style=3D"color:rgb(102,102,0)">=
,</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0=
,136,0)">&quot;2&quot;</span><span style=3D"color:rgb(0,0,0)"> </span><span=
 style=3D"color:rgb(102,102,0)">},</span><span style=3D"color:rgb(0,0,0)"> =
</span><span style=3D"color:rgb(102,102,0)">{</span><span style=3D"color:rg=
b(0,0,0)"> </span><span style=3D"color:rgb(0,102,102)">3</span><span style=
=3D"color:rgb(102,102,0)">,</span><span style=3D"color:rgb(0,0,0)"> </span>=
<span style=3D"color:rgb(0,136,0)">&quot;3&quot;</span><span style=3D"color=
:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">},</span><span st=
yle=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">{</sp=
an><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,102,=
102)">4</span><span style=3D"color:rgb(102,102,0)">,</span><span style=3D"c=
olor:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,136,0)">&quot;4&quot;</=
span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,=
102,0)">},</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"co=
lor:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"> </span><span =
style=3D"color:rgb(0,102,102)">5</span><span style=3D"color:rgb(102,102,0)"=
>,</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(=
0,136,0)">&quot;5&quot;</span><span style=3D"color:rgb(0,0,0)"> </span><spa=
n style=3D"color:rgb(102,102,0)">}</span><span style=3D"color:rgb(0,0,0)"> =
</span><span style=3D"color:rgb(102,102,0)">};</span></div></code></div></p=
re><br><br><br>Am Dienstag, 31. Oktober 2017 19:42:18 UTC+1 schrieb Zhihao =
Yuan:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8e=
x;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><di=
v><div>On Tue, Oct 31, 2017 at 1:28 PM,  <span dir=3D"ltr">&lt;<a href=3D"j=
avascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"d3iut6r_BgAJ" rel=3D=
"nofollow" onmousedown=3D"this.href=3D&#39;javascript:&#39;;return true;" o=
nclick=3D"this.href=3D&#39;javascript:&#39;;return true;">ma.ka...@googlema=
il.com</a>&gt;</span> wrote:<br><div><div class=3D"gmail_quote"><blockquote=
 style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);p=
adding-left:1ex" class=3D"gmail_quote"><br><div dir=3D"ltr">The compiler ca=
nnot deduce the type. We would have to write

<span><pre><div style=3D"background-color:rgb(250,250,250);border-color:rgb=
(187,187,187);border-style:solid;border-width:1px"><code><div><span style=
=3D"color:rgb(102,0,102)">Container</span><span style=3D"color:rgb(102,102,=
0)">&lt;</span><span style=3D"color:rgb(102,0,102)">Element</span><span sty=
le=3D"color:rgb(102,102,0)">,</span><span style=3D"color:rgb(0,0,0)"> </spa=
n><span style=3D"color:rgb(0,102,102)">5</span><span style=3D"color:rgb(102=
,102,0)">&gt;</span><span style=3D"color:rgb(0,0,0)"> c</span><span style=
=3D"color:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"> </span>=
<span style=3D"color:rgb(102,0,102)">Element</span><span style=3D"color:rgb=
(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"> </span><span style=
=3D"color:rgb(0,102,102)">1</span><span style=3D"color:rgb(102,102,0)">,</s=
pan><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,136=
,0)">&quot;1&quot;</span><span style=3D"color:rgb(0,0,0)"> </span><span sty=
le=3D"color:rgb(102,102,0)">},</span><span style=3D"color:rgb(0,0,0)"> </sp=
an><span style=3D"color:rgb(102,0,102)">Element</span><span style=3D"color:=
rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"> </span><span styl=
e=3D"color:rgb(0,102,102)">2</span><span style=3D"color:rgb(102,102,0)">,</=
span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,13=
6,0)">&quot;2&quot;</span><span style=3D"color:rgb(0,0,0)"> </span><span st=
yle=3D"color:rgb(102,102,0)">},</span><span style=3D"color:rgb(0,0,0)"> </s=
pan><span style=3D"color:rgb(102,0,102)">Element</span><span style=3D"color=
:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"> </span><span sty=
le=3D"color:rgb(0,102,102)">3</span><span style=3D"color:rgb(102,102,0)">,<=
/span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,1=
36,0)">&quot;3&quot;</span><span style=3D"color:rgb(0,0,0)"> </span><span s=
tyle=3D"color:rgb(102,102,0)">},</span><span style=3D"color:rgb(0,0,0)"> </=
span><span style=3D"color:rgb(102,0,102)">Element</span><span style=3D"colo=
r:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"> </span><span st=
yle=3D"color:rgb(0,102,102)">4</span><span style=3D"color:rgb(102,102,0)">,=
</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,=
136,0)">&quot;4&quot;</span><span style=3D"color:rgb(0,0,0)"> </span><span =
style=3D"color:rgb(102,102,0)">},</span><span style=3D"color:rgb(0,0,0)"> <=
/span><span style=3D"color:rgb(102,0,102)">Element</span><span style=3D"col=
or:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"> </span><span s=
tyle=3D"color:rgb(0,102,102)">5</span><span style=3D"color:rgb(102,102,0)">=
,</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0=
,136,0)">&quot;5&quot;</span><span style=3D"color:rgb(0,0,0)"> </span><span=
 style=3D"color:rgb(102,102,0)">}</span><span style=3D"color:rgb(0,0,0)"> <=
/span><span style=3D"color:rgb(102,102,0)">};</span></div></code></div></pr=
e></span>The problem is the variadic template argument list. It cannot dedu=
ce the type for of the passed arguments. I think this problem is not solvab=
le using deduction guides.<br></div></blockquote></div><br></div><div>Your =
problem is not &quot;compiler cannot deduce the type&quot;.<br></div><div>Y=
our desired outcome is to write:<br><br><pre><div style=3D"background-color=
:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-w=
idth:1px"><code><div><span style=3D"color:rgb(102,0,102)">Container</span><=
span style=3D"color:rgb(102,102,0)">&lt;</span><span style=3D"color:rgb(102=
,0,102)">Element</span><span style=3D"color:rgb(102,102,0)"></span><span st=
yle=3D"color:rgb(0,0,0)"></span><span style=3D"color:rgb(0,102,102)"></span=
><span style=3D"color:rgb(102,102,0)">&gt;</span><span style=3D"color:rgb(0=
,0,0)"> c</span><span style=3D"color:rgb(102,102,0)">{</span><span style=3D=
"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">{</span><sp=
an style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,102,102)">=
1</span><span style=3D"color:rgb(102,102,0)">,</span><span style=3D"color:r=
gb(0,0,0)"> </span><span style=3D"color:rgb(0,136,0)">&quot;1&quot;</span><=
span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)=
">},</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rg=
b(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"> </span><span style=
=3D"color:rgb(0,102,102)">2</span><span style=3D"color:rgb(102,102,0)">,</s=
pan><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,136=
,0)">&quot;2&quot;</span><span style=3D"color:rgb(0,0,0)"> </span><span sty=
le=3D"color:rgb(102,102,0)">},</span><span style=3D"color:rgb(0,0,0)"> </sp=
an><span style=3D"color:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,=
0,0)"> </span><span style=3D"color:rgb(0,102,102)">3</span><span style=3D"c=
olor:rgb(102,102,0)">,</span><span style=3D"color:rgb(0,0,0)"> </span><span=
 style=3D"color:rgb(0,136,0)">&quot;3&quot;</span><span style=3D"color:rgb(=
0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">},</span><span style=
=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">{</span>=
<span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,102,102=
)">4</span><span style=3D"color:rgb(102,102,0)">,</span><span style=3D"colo=
r:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,136,0)">&quot;4&quot;</spa=
n><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102=
,0)">},</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color=
:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"> </span><span sty=
le=3D"color:rgb(0,102,102)">5</span><span style=3D"color:rgb(102,102,0)">,<=
/span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,1=
36,0)">&quot;5&quot;</span><span style=3D"color:rgb(0,0,0)"> </span><span s=
tyle=3D"color:rgb(102,102,0)">}</span><span style=3D"color:rgb(0,0,0)"> </s=
pan><span style=3D"color:rgb(102,102,0)">};</span></div></code></div></pre>=
</div><br></div>Where you already supplied the element type<br><br></div>=
=C2=A0=C2=A0=C2=A0 Container&lt;Element /* right here */&gt;<br><br></div>S=
o with my idea raised at<br><br>=C2=A0 <a href=3D"https://groups.google.com=
/a/isocpp.org/forum/#!topic/std-proposals/P_RbANIP7cY" target=3D"_blank" re=
l=3D"nofollow" onmousedown=3D"this.href=3D&#39;https://groups.google.com/a/=
isocpp.org/forum/#!topic/std-proposals/P_RbANIP7cY&#39;;return true;" oncli=
ck=3D"this.href=3D&#39;https://groups.google.com/a/isocpp.org/forum/#!topic=
/std-proposals/P_RbANIP7cY&#39;;return true;">https://groups.google.com/a/<=
wbr>isocpp.org/forum/#!topic/std-<wbr>proposals/P_RbANIP7cY</a><br><div><di=
v><div><div><br></div><div>The following (new kind of) deduction guide will=
<br>have this outcome:<br></div><div><br><div>=C2=A0=C2=A0=C2=A0 template &=
lt;typename T, typename... U&gt;<br>=C2=A0=C2=A0=C2=A0 Container&lt;T&gt;(U=
....) -&gt; Container&lt;T, sizeof...(U)&gt;;<br clear=3D"all"><br>-- <br><d=
iv><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"ltr"><div>Zhihao=
 Yuan, ID lichray<br>The best way to predict the future is to invent it.<br=
>______________________________<wbr>_________________<br></div></div></div>=
</div></div></div></div>
</div></div></div></div></div></div>
</blockquote></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/616d6d02-c875-418a-a02f-a189733d5f5a%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/616d6d02-c875-418a-a02f-a189733d5f5a=
%40isocpp.org</a>.<br />

------=_Part_8992_424164444.1509475868560--

------=_Part_8991_1278987492.1509475868559--

.


Author: Zhihao Yuan <zy@miator.net>
Date: Tue, 31 Oct 2017 13:55:35 -0500
Raw View
--001a114a7b86f346c7055cdc4c0a
Content-Type: text/plain; charset="UTF-8"

On Tue, Oct 31, 2017 at 1:51 PM, ma.kalbfuss via ISO C++ Standard - Future
Proposals <std-proposals@isocpp.org> wrote:

template <typename T, typename... U>
> Container<T>(U...) -> Container<T, sizeof...(U)>;
>
> The Problem is U... not T. Even if T is known, U... is not. That's why you
> still cannot write
>
> Container<Element> c{ { 1, "1" }, { 2, "2" }, { 3, "3" }, { 4, "4" }, { 5, "5" } };
>
>
>
I just noticed that, and I suggest to fix the example by
repeating T along with U... in the argument list.
Deduction guide signature can be vastly different from
that of constructors, otherwise we can't deduce from
any forwarding references.

--
Zhihao Yuan, ID lichray
The best way to predict the future is to invent it.
_______________________________________________

--
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/CAGsORuBBOBWA3uKj805x306GFatuJ9kJzVYErSh0iQopb2wMJA%40mail.gmail.com.

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

<div dir=3D"ltr">On Tue, Oct 31, 2017 at 1:51 PM, ma.kalbfuss via ISO C++ S=
tandard - Future Proposals <span dir=3D"ltr">&lt;<a href=3D"mailto:std-prop=
osals@isocpp.org" target=3D"_blank">std-proposals@isocpp.org</a>&gt;</span>=
 wrote:<br><div class=3D"gmail_extra"><div class=3D"gmail_quote"><br><block=
quote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc=
 solid;padding-left:1ex"><div dir=3D"ltr"><span class=3D""><div style=3D"ba=
ckground-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:=
solid;border-width:1px" class=3D"m_-2495016021298768245prettyprint"><code c=
lass=3D"m_-2495016021298768245prettyprint"><div class=3D"m_-249501602129876=
8245subprettyprint"><span style=3D"color:#008" class=3D"m_-2495016021298768=
245styled-by-prettify">template</span><span style=3D"color:#000" class=3D"m=
_-2495016021298768245styled-by-prettify"> </span><span style=3D"color:#660"=
 class=3D"m_-2495016021298768245styled-by-prettify">&lt;</span><span style=
=3D"color:#008" class=3D"m_-2495016021298768245styled-by-prettify">typename=
</span><span style=3D"color:#000" class=3D"m_-2495016021298768245styled-by-=
prettify"> T</span><span style=3D"color:#660" class=3D"m_-24950160212987682=
45styled-by-prettify">,</span><span style=3D"color:#000" class=3D"m_-249501=
6021298768245styled-by-prettify"> </span><span style=3D"color:#008" class=
=3D"m_-2495016021298768245styled-by-prettify">typename</span><span style=3D=
"color:#660" class=3D"m_-2495016021298768245styled-by-prettify">...</span><=
span style=3D"color:#000" class=3D"m_-2495016021298768245styled-by-prettify=
"> U</span><span style=3D"color:#660" class=3D"m_-2495016021298768245styled=
-by-prettify">&gt;</span><span style=3D"color:#000" class=3D"m_-24950160212=
98768245styled-by-prettify"><br></span><span style=3D"color:#606" class=3D"=
m_-2495016021298768245styled-by-prettify">Container</span><span style=3D"co=
lor:#660" class=3D"m_-2495016021298768245styled-by-prettify">&lt;</span><sp=
an style=3D"color:#000" class=3D"m_-2495016021298768245styled-by-prettify">=
T</span><span style=3D"color:#660" class=3D"m_-2495016021298768245styled-by=
-prettify">&gt;(</span><span style=3D"color:#000" class=3D"m_-2495016021298=
768245styled-by-prettify">U</span><span style=3D"color:#660" class=3D"m_-24=
95016021298768245styled-by-prettify">...)</span><span style=3D"color:#000" =
class=3D"m_-2495016021298768245styled-by-prettify"> </span><span style=3D"c=
olor:#660" class=3D"m_-2495016021298768245styled-by-prettify">-&gt;</span><=
span style=3D"color:#000" class=3D"m_-2495016021298768245styled-by-prettify=
"> </span><span style=3D"color:#606" class=3D"m_-2495016021298768245styled-=
by-prettify">Container</span><span style=3D"color:#660" class=3D"m_-2495016=
021298768245styled-by-prettify">&lt;</span><span style=3D"color:#000" class=
=3D"m_-2495016021298768245styled-by-prettify">T</span><span style=3D"color:=
#660" class=3D"m_-2495016021298768245styled-by-prettify">,</span><span styl=
e=3D"color:#000" class=3D"m_-2495016021298768245styled-by-prettify"> </span=
><span style=3D"color:#008" class=3D"m_-2495016021298768245styled-by-pretti=
fy">sizeof</span><span style=3D"color:#660" class=3D"m_-2495016021298768245=
styled-by-prettify">...(</span><span style=3D"color:#000" class=3D"m_-24950=
16021298768245styled-by-prettify">U</span><span style=3D"color:#660" class=
=3D"m_-2495016021298768245styled-by-prettify">)&gt;;</span></div></code></d=
iv><br></span>The Problem is U... not T. Even if T is known, U... is not. T=
hat&#39;s why you still cannot write<span class=3D""><br><br><pre><div styl=
e=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);border=
-style:solid;border-width:1px"><code><div><span style=3D"color:rgb(102,0,10=
2)">Container</span><span style=3D"color:rgb(102,102,0)">&lt;</span><span s=
tyle=3D"color:rgb(102,0,102)">Element</span><span style=3D"color:rgb(102,10=
2,0)"></span><span style=3D"color:rgb(0,0,0)"></span><span style=3D"color:r=
gb(0,102,102)"></span><span style=3D"color:rgb(102,102,0)">&gt;</span><span=
 style=3D"color:rgb(0,0,0)"> c</span><span style=3D"color:rgb(102,102,0)">{=
</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(10=
2,102,0)">{</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"c=
olor:rgb(0,102,102)">1</span><span style=3D"color:rgb(102,102,0)">,</span><=
span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,136,0)">=
&quot;1&quot;</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D=
"color:rgb(102,102,0)">},</span><span style=3D"color:rgb(0,0,0)"> </span><s=
pan style=3D"color:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"=
> </span><span style=3D"color:rgb(0,102,102)">2</span><span style=3D"color:=
rgb(102,102,0)">,</span><span style=3D"color:rgb(0,0,0)"> </span><span styl=
e=3D"color:rgb(0,136,0)">&quot;2&quot;</span><span style=3D"color:rgb(0,0,0=
)"> </span><span style=3D"color:rgb(102,102,0)">},</span><span style=3D"col=
or:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">{</span><span s=
tyle=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,102,102)">3</s=
pan><span style=3D"color:rgb(102,102,0)">,</span><span style=3D"color:rgb(0=
,0,0)"> </span><span style=3D"color:rgb(0,136,0)">&quot;3&quot;</span><span=
 style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">},=
</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(10=
2,102,0)">{</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D"c=
olor:rgb(0,102,102)">4</span><span style=3D"color:rgb(102,102,0)">,</span><=
span style=3D"color:rgb(0,0,0)"> </span><span style=3D"color:rgb(0,136,0)">=
&quot;4&quot;</span><span style=3D"color:rgb(0,0,0)"> </span><span style=3D=
"color:rgb(102,102,0)">},</span><span style=3D"color:rgb(0,0,0)"> </span><s=
pan style=3D"color:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"=
> </span><span style=3D"color:rgb(0,102,102)">5</span><span style=3D"color:=
rgb(102,102,0)">,</span><span style=3D"color:rgb(0,0,0)"> </span><span styl=
e=3D"color:rgb(0,136,0)">&quot;5&quot;</span><span style=3D"color:rgb(0,0,0=
)"> </span><span style=3D"color:rgb(102,102,0)">}</span><span style=3D"colo=
r:rgb(0,0,0)"> </span><span style=3D"color:rgb(102,102,0)">};</span></div><=
/code></div></pre></span><span class=3D""></span><br></div></blockquote><di=
v><br></div><div>I just noticed that, and I suggest to fix the example by<b=
r>repeating T along with U... in the argument list.<br>Deduction guide sign=
ature can be vastly different from<br></div><div>that of constructors, othe=
rwise we can&#39;t deduce from<br></div><div>any forwarding references.<br>=
</div><div><br></div></div>-- <br><div class=3D"gmail_signature" data-smart=
mail=3D"gmail_signature"><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div d=
ir=3D"ltr"><div>Zhihao Yuan, ID lichray<br>The best way to predict the futu=
re is to invent it.<br>_______________________________________________<br><=
/div></div></div></div></div></div></div>
</div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&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/CAGsORuBBOBWA3uKj805x306GFatuJ9kJzVYE=
rSh0iQopb2wMJA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAGsORuBBOBWA3uKj=
805x306GFatuJ9kJzVYErSh0iQopb2wMJA%40mail.gmail.com</a>.<br />

--001a114a7b86f346c7055cdc4c0a--

.