Topic: extended parameter pack deduction


Author: bruno.manga95@gmail.com
Date: Thu, 25 Feb 2016 10:09:01 -0800 (PST)
Raw View
------=_Part_1165_482368856.1456423741703
Content-Type: multipart/alternative;
 boundary="----=_Part_1166_958554413.1456423741704"

------=_Part_1166_958554413.1456423741704
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable



Hello,

Parameter packs are already allowed to appear anywhere a function parameter=
=20
list, but can only be deduced if they appear in the rightmost position.

I was wondering what the opinions are about allowing type deduction to be=
=20
performed on a function template whose parameter pack is not at the end of=
=20
the function parameter list, allowing for example

template<class... Args, class T>
T get_pack_last(Args..., T t)
{
     return t;
}


to compile without having to provide template arguments for the pack at the=
=20
call site.

A limitation would be that the deduction would fail if the parameter list=
=20
contains any default arguments or if more than one parameter pack is presen=
t

Note that ambiguities such as
template<class... Args>
void foo(int, Args=E2=80=A6);

template<class... Args>
void foo(Args=E2=80=A6, int);


foo<int, int, int>(1, 2, 3, 4);=20


already exist. This code, for example, produces an ambiguous call error in=
=20
clang, whereas gcc selects the first overload (I am not sure who=E2=80=99s =
right=20
here, though it seems to me that an ambiguous error is more appropriate).=
=20

Thus

foo(1, 2, 3, 4);


should have the right to be just as ambiguous :)

A couple of  toy use cases are:
template <class...Args>
auto alternate(Args... args)
{
     return make_tuple(args...);
}

template< class First, class... Rest, class Last>
auto alternate(First first, Rest... rest, Last last)
{
     return tuple_cat(make_tuple(first, last), alternate(rest...));
}



template <class=E2=80=A6 Args>
bool ends_with_bool_char(Args=E2=80=A6)
{
     return false;
}

template-<class=E2=80=A6 Args>
bool ends_with_bool_char(Args=E2=80=A6, bool, char)
{
     return true;
}





--=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/c41678fd-3271-4da8-843a-8a1487d82a15%40isocpp.or=
g.

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

<div dir=3D"ltr"><span id=3D"docs-internal-guid-a1b9e7cb-1992-ef91-bd6d-932=
5b2ac0334"><p dir=3D"ltr" style=3D"line-height:1.38;margin-top:0pt;margin-b=
ottom:0pt;"><span style=3D"font-size: 14.6667px; font-family: Arial; color:=
 rgb(0, 0, 0); vertical-align: baseline; white-space: pre-wrap; background-=
color: transparent;">Hello,</span></p><br><p dir=3D"ltr" style=3D"line-heig=
ht:1.38;margin-top:0pt;margin-bottom:0pt;"><span style=3D"font-size: 14.666=
7px; font-family: Arial; color: rgb(0, 0, 0); vertical-align: baseline; whi=
te-space: pre-wrap; background-color: transparent;">Parameter packs are alr=
eady allowed to appear anywhere a function parameter list, but can only be =
deduced if they appear in the rightmost position.</span></p><br><p dir=3D"l=
tr" style=3D"line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span styl=
e=3D"font-size: 14.6667px; font-family: Arial; color: rgb(0, 0, 0); vertica=
l-align: baseline; white-space: pre-wrap; background-color: transparent;">I=
 was wondering what the opinions are about allowing type deduction to be pe=
rformed on a function template whose parameter pack is not at the end of th=
e function parameter list, allowing for example</span></p><br><div class=3D=
"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: bre=
ak-word; background-color: rgb(250, 250, 250);"><code class=3D"prettyprint"=
><div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled=
-by-prettify">template</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">class</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>...</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #606;" class=3D"styled-by-prettify">Args</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=
: #008;" class=3D"styled-by-prettify">class</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br>T get_pack_last</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">(</span><span style=3D"color: #606;" class=3D"s=
tyled-by-prettify">Args</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">...,</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> T t</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=
=A0</span><span style=3D"color: #008;" class=3D"styled-by-prettify">return<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> t</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">}</span></div></code></div><p dir=
=3D"ltr" style=3D"line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><br><=
/p><p dir=3D"ltr" style=3D"line-height:1.38;margin-top:0pt;margin-bottom:0p=
t;"><span style=3D"font-size: 14.6667px; font-family: Arial; color: rgb(0, =
0, 0); vertical-align: baseline; white-space: pre-wrap; background-color: t=
ransparent;">to compile without having to provide template arguments for th=
e pack at the call site.</span><span style=3D"font-size: 14.6667px; font-fa=
mily: Arial; color: rgb(0, 0, 0); vertical-align: baseline; white-space: pr=
e-wrap; background-color: transparent;"><br class=3D"kix-line-break"></span=
><span style=3D"font-size: 14.6667px; font-family: Arial; color: rgb(0, 0, =
0); vertical-align: baseline; white-space: pre-wrap; background-color: tran=
sparent;"><br class=3D"kix-line-break"></span><span style=3D"font-size: 14.=
6667px; font-family: Arial; color: rgb(0, 0, 0); vertical-align: baseline; =
white-space: pre-wrap; background-color: transparent;">A limitation would b=
e that the deduction would fail if the parameter list contains any default =
arguments or if more than one parameter pack is present</span></p><br><p di=
r=3D"ltr" style=3D"line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><spa=
n style=3D"font-size: 14.6667px; font-family: Arial; color: rgb(0, 0, 0); v=
ertical-align: baseline; white-space: pre-wrap; background-color: transpare=
nt;">Note that ambiguities such as</span><span style=3D"font-size: 14.6667p=
x; font-family: Arial; color: rgb(0, 0, 0); vertical-align: baseline; white=
-space: pre-wrap; background-color: transparent;"><br class=3D"kix-line-bre=
ak"></span><span style=3D"font-size: 14.6667px; font-family: Arial; color: =
rgb(0, 0, 0); vertical-align: baseline; white-space: pre-wrap; background-c=
olor: transparent;"></span></p><div class=3D"prettyprint" style=3D"border: =
1px solid rgb(187, 187, 187); word-wrap: break-word; background-color: rgb(=
250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subprettyprint">=
<span style=3D"color: #008;" class=3D"styled-by-prettify">template</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">class</span><span style=
=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: #606;=
" class=3D"styled-by-prettify">Args</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">&gt;</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-=
by-prettify">void</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> foo</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">int</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: #606;" class=3D"styled-by-prettify">Args</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">=E2=80=A6);</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">template</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">class</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">...</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-pr=
ettify">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>=
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">void</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> foo</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">=E2=80=A6,</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><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"styl=
ed-by-prettify"><br><br><br>foo</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">int</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: #008;" class=3D"styled-by-prettify">int</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: #008;" class=3D"styled-by-prettify">int</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">&gt;(</span><span style=3D"color: #066;" c=
lass=3D"styled-by-prettify">1</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: #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 sty=
le=3D"color: #066;" class=3D"styled-by-prettify">3</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">4</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">);</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span></div></code></div><p dir=3D"ltr" style=3D"line-height:1.38;=
margin-top:0pt;margin-bottom:0pt;"><span style=3D"font-size: 14.6667px; fon=
t-family: Arial; color: rgb(0, 0, 0); vertical-align: baseline; white-space=
: pre-wrap; background-color: transparent;"><br></span></p><p dir=3D"ltr" s=
tyle=3D"line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style=3D"=
font-size: 14.6667px; font-family: Arial; color: rgb(0, 0, 0); vertical-ali=
gn: baseline; white-space: pre-wrap; background-color: transparent;">alread=
y exist. This code, for example, produces an ambiguous call error in clang,=
 whereas gcc selects the first overload (I am not sure who=E2=80=99s right =
here, though it seems to me that an ambiguous error is more appropriate). <=
/span></p><br><p dir=3D"ltr" style=3D"line-height:1.38;margin-top:0pt;margi=
n-bottom:0pt;"><span style=3D"font-size: 14.6667px; font-family: Arial; col=
or: rgb(0, 0, 0); vertical-align: baseline; white-space: pre-wrap; backgrou=
nd-color: transparent;">Thus</span></p><p dir=3D"ltr" style=3D"line-height:=
1.38;margin-top:0pt;margin-bottom:0pt;"><span style=3D"font-size: 14.6667px=
; font-family: Arial; color: rgb(0, 0, 0); vertical-align: baseline; white-=
space: pre-wrap; background-color: transparent;"></span></p><div class=3D"p=
rettyprint" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break=
-word; background-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><=
div class=3D"subprettyprint"><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">foo</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">(</span><span style=3D"color: #066;" class=3D"styled-by-prettify">1</s=
pan><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">2</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #066;" class=3D"sty=
led-by-prettify">3</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></div></co=
de></div></span><p></p><p dir=3D"ltr" style=3D"line-height:1.38;margin-top:=
0pt;margin-bottom:0pt;"><span style=3D"font-size: 14.6667px; font-family: A=
rial; color: rgb(0, 0, 0); vertical-align: baseline; white-space: pre-wrap;=
 background-color: transparent;"><br></span></p><p dir=3D"ltr" style=3D"lin=
e-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style=3D"font-size: =
14.6667px; font-family: Arial; color: rgb(0, 0, 0); vertical-align: baselin=
e; white-space: pre-wrap; background-color: transparent;">should have the r=
ight to be just as ambiguous :)</span></p><br><p dir=3D"ltr" style=3D"line-=
height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style=3D"font-size: 14=
..6667px; font-family: Arial; color: rgb(0, 0, 0); vertical-align: baseline;=
 white-space: pre-wrap; background-color: transparent;">A couple of =C2=A0t=
oy use cases are:</span><span style=3D"font-size: 14.6667px; font-family: A=
rial; color: rgb(0, 0, 0); vertical-align: baseline; white-space: pre-wrap;=
 background-color: transparent;"><br class=3D"kix-line-break"></span><span =
style=3D"font-size: 12px; font-family: Arial; color: rgb(20, 24, 35); verti=
cal-align: baseline; white-space: pre-wrap; background-color: rgb(246, 247,=
 248);"></span></p><div class=3D"prettyprint" style=3D"border: 1px solid rg=
b(187, 187, 187); word-wrap: break-word; background-color: rgb(250, 250, 25=
0);"><code 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;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">class</span><span style=3D"color: #660;" cl=
ass=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-pr=
ettify"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">auto</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> alt=
ernate</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</s=
pan><span style=3D"color: #606;" class=3D"styled-by-prettify">Args</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">...</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> args</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0</span><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">return</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> make_tuple</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">args</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">...);</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">temp=
late</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&lt;</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">class</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #606;" class=3D"styled-by-prettify">First</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">class</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">...</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">Rest=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">class</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #60=
6;" class=3D"styled-by-prettify">Last</span><span style=3D"color: #660;" cl=
ass=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"style=
d-by-prettify">auto</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> alternate</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">(</span><span style=3D"color: #606;" class=3D"styled-by-prettify">=
First</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> firs=
t</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #606;" class=3D"styled-by-prettify">Rest</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">...</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> rest</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"styled-b=
y-prettify">Last</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">las=
t</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0</span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">return</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> tuple_cat</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify">make_tuple</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify">first</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">last</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">),</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> al=
ternate</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify">rest</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">...));</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">}</span></div></code></div><=
p dir=3D"ltr" style=3D"line-height:1.38;margin-top:0pt;margin-bottom:0pt;">=
<br></p><br><div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, =
187, 187); word-wrap: break-word; background-color: rgb(250, 250, 250);"><c=
ode class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">template</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">class</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">=E2=80=A6</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-p=
rettify">Args</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
></span><span style=3D"color: #008;" class=3D"styled-by-prettify">bool</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> ends_with_bool=
_char</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</sp=
an><span style=3D"color: #606;" class=3D"styled-by-prettify">Args</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">=E2=80=A6)</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0</span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">return</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">false</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br><br></span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">template</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">-&lt;</span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">class</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
=E2=80=A6</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></span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">bool</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> ends_with_bool_char</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"c=
olor: #606;" class=3D"styled-by-prettify">Args</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">=E2=80=A6,</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">bool</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">char</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0</s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">return</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">true</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">}</span></div></code></div><p dir=3D"ltr" style=
=3D"line-height:1.38;margin-top:0pt;margin-bottom:0pt;"><span style=3D"font=
-size: 14.6667px; font-family: Arial; color: rgb(0, 0, 0); vertical-align: =
baseline; white-space: pre-wrap; background-color: transparent;"><br></span=
></p><br><br><br></div>

<p></p>

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

------=_Part_1166_958554413.1456423741704--
------=_Part_1165_482368856.1456423741703--

.


Author: NDos Dannyu <ndospark320@naver.com>
Date: Sat, 27 Feb 2016 06:15:29 -0800 (PST)
Raw View
------=_Part_2029_1727798670.1456582530013
Content-Type: multipart/alternative;
 boundary="----=_Part_2030_59479623.1456582530014"

------=_Part_2030_59479623.1456582530014
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable



2016=EB=85=84 2=EC=9B=94 26=EC=9D=BC =EA=B8=88=EC=9A=94=EC=9D=BC =EC=98=A4=
=EC=A0=84 3=EC=8B=9C 9=EB=B6=84 1=EC=B4=88 UTC+9, bruno....@gmail.com =EB=
=8B=98=EC=9D=98 =EB=A7=90:
>
> Hello,
>
> Parameter packs are already allowed to appear anywhere a function=20
> parameter list, but can only be deduced if they appear in the rightmost=
=20
> position.
>
> I was wondering what the opinions are about allowing type deduction to be=
=20
> performed on a function template whose parameter pack is not at the end o=
f=20
> the function parameter list, allowing for example
>
> template<class... Args, class T>
> T get_pack_last(Args..., T t)
> {
>      return t;
> }
>
>
> to compile without having to provide template arguments for the pack at=
=20
> the call site.
>
> A limitation would be that the deduction would fail if the parameter list=
=20
> contains any default arguments or if more than one parameter pack is pres=
ent
>
> Note that ambiguities such as
> template<class... Args>
> void foo(int, Args=E2=80=A6);
>
> template<class... Args>
> void foo(Args=E2=80=A6, int);
>
>
> foo<int, int, int>(1, 2, 3, 4);=20
>
>
> already exist. This code, for example, produces an ambiguous call error i=
n=20
> clang, whereas gcc selects the first overload (I am not sure who=E2=80=99=
s right=20
> here, though it seems to me that an ambiguous error is more appropriate).=
=20
>
> Thus
>
> foo(1, 2, 3, 4);
>
>
> should have the right to be just as ambiguous :)
>
> A couple of  toy use cases are:
> template <class...Args>
> auto alternate(Args... args)
> {
>      return make_tuple(args...);
> }
>
> template< class First, class... Rest, class Last>
> auto alternate(First first, Rest... rest, Last last)
> {
>      return tuple_cat(make_tuple(first, last), alternate(rest...));
> }
>
>
>
> template <class=E2=80=A6 Args>
> bool ends_with_bool_char(Args=E2=80=A6)
> {
>      return false;
> }
>
> template-<class=E2=80=A6 Args>
> bool ends_with_bool_char(Args=E2=80=A6, bool, char)
> {
>      return true;
> }
>
>
Function parameter packs are allowed to appear at any position.
Template parameter packs can only appear at the rightmost position.=20
=20

--=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/ee6f5350-dd1b-4a18-96a7-8ce130708602%40isocpp.or=
g.

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

<div dir=3D"ltr"><br><br>2016=EB=85=84 2=EC=9B=94 26=EC=9D=BC =EA=B8=88=EC=
=9A=94=EC=9D=BC =EC=98=A4=EC=A0=84 3=EC=8B=9C 9=EB=B6=84 1=EC=B4=88 UTC+9, =
bruno....@gmail.com =EB=8B=98=EC=9D=98 =EB=A7=90:<blockquote class=3D"gmail=
_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;p=
adding-left: 1ex;"><div dir=3D"ltr"><span><p style=3D"line-height:1.38;marg=
in-top:0pt;margin-bottom:0pt" dir=3D"ltr"><span style=3D"font-size:14.6667p=
x;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pr=
e-wrap;background-color:transparent">Hello,</span></p><br><p style=3D"line-=
height:1.38;margin-top:0pt;margin-bottom:0pt" dir=3D"ltr"><span style=3D"fo=
nt-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baselin=
e;white-space:pre-wrap;background-color:transparent">Parameter packs are al=
ready allowed to appear anywhere a function parameter list, but can only be=
 deduced if they appear in the rightmost position.</span></p><br><p style=
=3D"line-height:1.38;margin-top:0pt;margin-bottom:0pt" dir=3D"ltr"><span st=
yle=3D"font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-alig=
n:baseline;white-space:pre-wrap;background-color:transparent">I was wonderi=
ng what the opinions are about allowing type deduction to be performed on a=
 function template whose parameter pack is not at the end of the function p=
arameter list, allowing for example</span></p><br><div style=3D"border:1px =
solid rgb(187,187,187);word-wrap:break-word;background-color:rgb(250,250,25=
0)"><code><div><span style=3D"color:#008">template</span><span style=3D"col=
or:#660">&lt;</span><span style=3D"color:#008">class</span><span style=3D"c=
olor:#660">...</span><span style=3D"color:#000"> </span><span style=3D"colo=
r:#606">Args</span><span style=3D"color:#660">,</span><span style=3D"color:=
#000"> </span><span style=3D"color:#008">class</span><span style=3D"color:#=
000"> T</span><span style=3D"color:#660">&gt;</span><span style=3D"color:#0=
00"><br>T get_pack_last</span><span style=3D"color:#660">(</span><span styl=
e=3D"color:#606">Args</span><span style=3D"color:#660">...,</span><span sty=
le=3D"color:#000"> T t</span><span style=3D"color:#660">)</span><span style=
=3D"color:#000"><br></span><span style=3D"color:#660">{</span><span style=
=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0</span><span style=3D"color:#008">r=
eturn</span><span style=3D"color:#000"> t</span><span style=3D"color:#660">=
;</span><span style=3D"color:#000"><br></span><span style=3D"color:#660">}<=
/span></div></code></div><p style=3D"line-height:1.38;margin-top:0pt;margin=
-bottom:0pt" dir=3D"ltr"><br></p><p style=3D"line-height:1.38;margin-top:0p=
t;margin-bottom:0pt" dir=3D"ltr"><span style=3D"font-size:14.6667px;font-fa=
mily:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;ba=
ckground-color:transparent">to compile without having to provide template a=
rguments for the pack at the call site.</span><span style=3D"font-size:14.6=
667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-spac=
e:pre-wrap;background-color:transparent"><br></span><span style=3D"font-siz=
e:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;whit=
e-space:pre-wrap;background-color:transparent"><br></span><span style=3D"fo=
nt-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baselin=
e;white-space:pre-wrap;background-color:transparent">A limitation would be =
that the deduction would fail if the parameter list contains any default ar=
guments or if more than one parameter pack is present</span></p><br><p styl=
e=3D"line-height:1.38;margin-top:0pt;margin-bottom:0pt" dir=3D"ltr"><span s=
tyle=3D"font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-ali=
gn:baseline;white-space:pre-wrap;background-color:transparent">Note that am=
biguities such as</span><span style=3D"font-size:14.6667px;font-family:Aria=
l;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-=
color:transparent"><br></span><span style=3D"font-size:14.6667px;font-famil=
y:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;backg=
round-color:transparent"></span></p><div style=3D"border:1px solid rgb(187,=
187,187);word-wrap:break-word;background-color:rgb(250,250,250)"><code><div=
><span style=3D"color:#008">template</span><span style=3D"color:#660">&lt;<=
/span><span style=3D"color:#008">class</span><span style=3D"color:#660">...=
</span><span style=3D"color:#000"> </span><span style=3D"color:#606">Args</=
span><span style=3D"color:#660">&gt;</span><span style=3D"color:#000"><br><=
/span><span style=3D"color:#008">void</span><span style=3D"color:#000"> foo=
</span><span style=3D"color:#660">(</span><span style=3D"color:#008">int</s=
pan><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><=
span style=3D"color:#606">Args</span><span style=3D"color:#660">=E2=80=A6);=
</span><span style=3D"color:#000"><br><br></span><span style=3D"color:#008"=
>template</span><span style=3D"color:#660">&lt;</span><span style=3D"color:=
#008">class</span><span style=3D"color:#660">...</span><span style=3D"color=
:#000"> </span><span style=3D"color:#606">Args</span><span style=3D"color:#=
660">&gt;</span><span style=3D"color:#000"><br></span><span style=3D"color:=
#008">void</span><span style=3D"color:#000"> foo</span><span style=3D"color=
:#660">(</span><span style=3D"color:#606">Args</span><span style=3D"color:#=
660">=E2=80=A6,</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#008">int</span><span style=3D"color:#660">);</span><span style=3D"color=
:#000"><br><br><br>foo</span><span style=3D"color:#660">&lt;</span><span st=
yle=3D"color:#008">int</span><span style=3D"color:#660">,</span><span style=
=3D"color:#000"> </span><span style=3D"color:#008">int</span><span style=3D=
"color:#660">,</span><span style=3D"color:#000"> </span><span style=3D"colo=
r:#008">int</span><span style=3D"color:#660">&gt;(</span><span style=3D"col=
or:#066">1</span><span style=3D"color:#660">,</span><span style=3D"color:#0=
00"> </span><span style=3D"color:#066">2</span><span style=3D"color:#660">,=
</span><span style=3D"color:#000"> </span><span style=3D"color:#066">3</spa=
n><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#066">4</span><span style=3D"color:#660">);</span><span s=
tyle=3D"color:#000"> </span></div></code></div><p style=3D"line-height:1.38=
;margin-top:0pt;margin-bottom:0pt" dir=3D"ltr"><span style=3D"font-size:14.=
6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-spa=
ce:pre-wrap;background-color:transparent"><br></span></p><p style=3D"line-h=
eight:1.38;margin-top:0pt;margin-bottom:0pt" dir=3D"ltr"><span style=3D"fon=
t-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline=
;white-space:pre-wrap;background-color:transparent">already exist. This cod=
e, for example, produces an ambiguous call error in clang, whereas gcc sele=
cts the first overload (I am not sure who=E2=80=99s right here, though it s=
eems to me that an ambiguous error is more appropriate). </span></p><br><p =
style=3D"line-height:1.38;margin-top:0pt;margin-bottom:0pt" dir=3D"ltr"><sp=
an style=3D"font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical=
-align:baseline;white-space:pre-wrap;background-color:transparent">Thus</sp=
an></p><p style=3D"line-height:1.38;margin-top:0pt;margin-bottom:0pt" dir=
=3D"ltr"><span style=3D"font-size:14.6667px;font-family:Arial;color:rgb(0,0=
,0);vertical-align:baseline;white-space:pre-wrap;background-color:transpare=
nt"></span></p><div style=3D"border:1px solid rgb(187,187,187);word-wrap:br=
eak-word;background-color:rgb(250,250,250)"><code><div><span style=3D"color=
:#000">foo</span><span style=3D"color:#660">(</span><span style=3D"color:#0=
66">1</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">,</spa=
n><span style=3D"color:#000"> </span><span style=3D"color:#066">3</span><sp=
an style=3D"color:#660">,</span><span style=3D"color:#000"> </span><span st=
yle=3D"color:#066">4</span><span style=3D"color:#660">);</span></div></code=
></div></span><p></p><p style=3D"line-height:1.38;margin-top:0pt;margin-bot=
tom:0pt" dir=3D"ltr"><span style=3D"font-size:14.6667px;font-family:Arial;c=
olor:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-col=
or:transparent"><br></span></p><p style=3D"line-height:1.38;margin-top:0pt;=
margin-bottom:0pt" dir=3D"ltr"><span style=3D"font-size:14.6667px;font-fami=
ly:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;back=
ground-color:transparent">should have the right to be just as ambiguous :)<=
/span></p><br><p style=3D"line-height:1.38;margin-top:0pt;margin-bottom:0pt=
" dir=3D"ltr"><span style=3D"font-size:14.6667px;font-family:Arial;color:rg=
b(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:tran=
sparent">A couple of =C2=A0toy use cases are:</span><span style=3D"font-siz=
e:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;whit=
e-space:pre-wrap;background-color:transparent"><br></span><span style=3D"fo=
nt-size:12px;font-family:Arial;color:rgb(20,24,35);vertical-align:baseline;=
white-space:pre-wrap;background-color:rgb(246,247,248)"></span></p><div sty=
le=3D"border:1px solid rgb(187,187,187);word-wrap:break-word;background-col=
or:rgb(250,250,250)"><code><div><span style=3D"color:#008">template</span><=
span style=3D"color:#000"> </span><span style=3D"color:#660">&lt;</span><sp=
an style=3D"color:#008">class</span><span style=3D"color:#660">...</span><s=
pan style=3D"color:#606">Args</span><span style=3D"color:#660">&gt;</span><=
span style=3D"color:#000"><br></span><span style=3D"color:#008">auto</span>=
<span style=3D"color:#000"> alternate</span><span style=3D"color:#660">(</s=
pan><span style=3D"color:#606">Args</span><span style=3D"color:#660">...</s=
pan><span style=3D"color:#000"> args</span><span style=3D"color:#660">)</sp=
an><span style=3D"color:#000"><br></span><span style=3D"color:#660">{</span=
><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0</span><span style=3D"c=
olor:#008">return</span><span style=3D"color:#000"> make_tuple</span><span =
style=3D"color:#660">(</span><span style=3D"color:#000">args</span><span st=
yle=3D"color:#660">...);</span><span style=3D"color:#000"><br></span><span =
style=3D"color:#660">}</span><span style=3D"color:#000"><br><br></span><spa=
n style=3D"color:#008">template</span><span style=3D"color:#660">&lt;</span=
><span style=3D"color:#000"> </span><span style=3D"color:#008">class</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#606">First</span><=
span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><span =
style=3D"color:#008">class</span><span style=3D"color:#660">...</span><span=
 style=3D"color:#000"> </span><span style=3D"color:#606">Rest</span><span s=
tyle=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=
=3D"color:#008">class</span><span style=3D"color:#000"> </span><span style=
=3D"color:#606">Last</span><span style=3D"color:#660">&gt;</span><span styl=
e=3D"color:#000"><br></span><span style=3D"color:#008">auto</span><span sty=
le=3D"color:#000"> alternate</span><span style=3D"color:#660">(</span><span=
 style=3D"color:#606">First</span><span style=3D"color:#000"> first</span><=
span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><span =
style=3D"color:#606">Rest</span><span style=3D"color:#660">...</span><span =
style=3D"color:#000"> rest</span><span style=3D"color:#660">,</span><span s=
tyle=3D"color:#000"> </span><span style=3D"color:#606">Last</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#008">last</span><span style=
=3D"color:#660">)</span><span style=3D"color:#000"><br></span><span style=
=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0=
</span><span style=3D"color:#008">return</span><span style=3D"color:#000"> =
tuple_cat</span><span style=3D"color:#660">(</span><span style=3D"color:#00=
0">make_tuple</span><span style=3D"color:#660">(</span><span style=3D"color=
:#000">first</span><span style=3D"color:#660">,</span><span style=3D"color:=
#000"> </span><span style=3D"color:#008">last</span><span style=3D"color:#6=
60">),</span><span style=3D"color:#000"> alternate</span><span style=3D"col=
or:#660">(</span><span style=3D"color:#000">rest</span><span style=3D"color=
:#660">...));</span><span style=3D"color:#000"><br></span><span style=3D"co=
lor:#660">}</span></div></code></div><p style=3D"line-height:1.38;margin-to=
p:0pt;margin-bottom:0pt" dir=3D"ltr"><br></p><br><div style=3D"border:1px s=
olid rgb(187,187,187);word-wrap:break-word;background-color:rgb(250,250,250=
)"><code><div><span style=3D"color:#008">template</span><span style=3D"colo=
r:#000"> </span><span style=3D"color:#660">&lt;</span><span style=3D"color:=
#008">class</span><span style=3D"color:#660">=E2=80=A6</span><span style=3D=
"color:#000"> </span><span style=3D"color:#606">Args</span><span style=3D"c=
olor:#660">&gt;</span><span style=3D"color:#000"><br></span><span style=3D"=
color:#008">bool</span><span style=3D"color:#000"> ends_with_bool_char</spa=
n><span style=3D"color:#660">(</span><span style=3D"color:#606">Args</span>=
<span style=3D"color:#660">=E2=80=A6)</span><span style=3D"color:#000"><br>=
</span><span style=3D"color:#660">{</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 =C2=A0</span><span style=3D"color:#008">return</span><span st=
yle=3D"color:#000"> </span><span style=3D"color:#008">false</span><span sty=
le=3D"color:#660">;</span><span style=3D"color:#000"><br></span><span style=
=3D"color:#660">}</span><span style=3D"color:#000"><br><br></span><span sty=
le=3D"color:#008">template</span><span style=3D"color:#660">-&lt;</span><sp=
an style=3D"color:#008">class</span><span style=3D"color:#660">=E2=80=A6</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#606">Args</spa=
n><span style=3D"color:#660">&gt;</span><span style=3D"color:#000"><br></sp=
an><span style=3D"color:#008">bool</span><span style=3D"color:#000"> ends_w=
ith_bool_char</span><span style=3D"color:#660">(</span><span style=3D"color=
:#606">Args</span><span style=3D"color:#660">=E2=80=A6,</span><span style=
=3D"color:#000"> </span><span style=3D"color:#008">bool</span><span style=
=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#008">char</span><span style=3D"color:#660">)</span><span style=3D"col=
or:#000"><br></span><span style=3D"color:#660">{</span><span style=3D"color=
:#000"><br>=C2=A0 =C2=A0 =C2=A0</span><span style=3D"color:#008">return</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#008">true</span=
><span style=3D"color:#660">;</span><span style=3D"color:#000"><br></span><=
span style=3D"color:#660">}</span></div></code><br></div></div></blockquote=
><div><div><br></div><div>Function parameter packs are allowed=C2=A0to appe=
ar=C2=A0at any position.</div><div>Template parameter packs=C2=A0can only a=
ppear at the rightmost position.=C2=A0</div>=C2=A0</div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&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/ee6f5350-dd1b-4a18-96a7-8ce130708602%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/ee6f5350-dd1b-4a18-96a7-8ce130708602=
%40isocpp.org</a>.<br />

------=_Part_2030_59479623.1456582530014--
------=_Part_2029_1727798670.1456582530013--

.


Author: bruno.manga95@gmail.com
Date: Sat, 27 Feb 2016 09:34:48 -0800 (PST)
Raw View
------=_Part_1739_711275109.1456594488774
Content-Type: multipart/alternative;
 boundary="----=_Part_1740_591484258.1456594488775"

------=_Part_1740_591484258.1456594488775
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

I believe the template parameter pack restriction only applies to class and=
=20
alias templates (14.1.11), and it is allowed in a function template deduced=
=20
context  (at least clang, gcc and msvc seem to agree).

The question is whether this rule relaxation can be a breaking change.=20
 Taking as example
template<class T, class... Args> void foo(T, Args...); //A
template<class T, class... Args> void foo(Args..., T); //B

calling=20
foo(1, 2, 3)

today unambiguously calls overload A, whereas if we allow B to be deduced=
=20
the call becomes ambiguous.  However, I doubt such code exist as there=20
seems to be no way of calling B.

On Saturday, 27 February 2016 14:15:30 UTC, NDos Dannyu wrote:
>
>
>
> 2016=EB=85=84 2=EC=9B=94 26=EC=9D=BC =EA=B8=88=EC=9A=94=EC=9D=BC =EC=98=
=A4=EC=A0=84 3=EC=8B=9C 9=EB=B6=84 1=EC=B4=88 UTC+9, bruno....@gmail.com =
=EB=8B=98=EC=9D=98 =EB=A7=90:
>>
>> Hello,
>>
>> Parameter packs are already allowed to appear anywhere a function=20
>> parameter list, but can only be deduced if they appear in the rightmost=
=20
>> position.
>>
>> I was wondering what the opinions are about allowing type deduction to b=
e=20
>> performed on a function template whose parameter pack is not at the end =
of=20
>> the function parameter list, allowing for example
>>
>> template<class... Args, class T>
>> T get_pack_last(Args..., T t)
>> {
>>      return t;
>> }
>>
>>
>> to compile without having to provide template arguments for the pack at=
=20
>> the call site.
>>
>> A limitation would be that the deduction would fail if the parameter lis=
t=20
>> contains any default arguments or if more than one parameter pack is pre=
sent
>>
>> Note that ambiguities such as
>> template<class... Args>
>> void foo(int, Args=E2=80=A6);
>>
>> template<class... Args>
>> void foo(Args=E2=80=A6, int);
>>
>>
>> foo<int, int, int>(1, 2, 3, 4);=20
>>
>>
>> already exist. This code, for example, produces an ambiguous call error=
=20
>> in clang, whereas gcc selects the first overload (I am not sure who=E2=
=80=99s right=20
>> here, though it seems to me that an ambiguous error is more appropriate)=
..=20
>>
>> Thus
>>
>> foo(1, 2, 3, 4);
>>
>>
>> should have the right to be just as ambiguous :)
>>
>> A couple of  toy use cases are:
>> template <class...Args>
>> auto alternate(Args... args)
>> {
>>      return make_tuple(args...);
>> }
>>
>> template< class First, class... Rest, class Last>
>> auto alternate(First first, Rest... rest, Last last)
>> {
>>      return tuple_cat(make_tuple(first, last), alternate(rest...));
>> }
>>
>>
>>
>> template <class=E2=80=A6 Args>
>> bool ends_with_bool_char(Args=E2=80=A6)
>> {
>>      return false;
>> }
>>
>> template-<class=E2=80=A6 Args>
>> bool ends_with_bool_char(Args=E2=80=A6, bool, char)
>> {
>>      return true;
>> }
>>
>>
> Function parameter packs are allowed to appear at any position.
> Template parameter packs can only appear at the rightmost position.=20
> =20
>

--=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/17742aab-d3f7-414c-ba6b-7edca93fba6f%40isocpp.or=
g.

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

<div dir=3D"ltr">I believe the template parameter pack restriction only app=
lies to class and alias templates (14.1.11), and it is allowed in a functio=
n template deduced context =C2=A0(at least clang, gcc and msvc seem to agre=
e).<div><div><br></div><div>The question is whether this rule relaxation ca=
n be a breaking change. =C2=A0Taking as example</div><div><div class=3D"pre=
ttyprint" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-w=
ord; background-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><di=
v class=3D"subprettyprint"><font color=3D"#660066"><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">template</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">class</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> T</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">class=
</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: #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"> </span><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">void</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> foo</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify">T</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"styled-by-prettify">Args</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">...);</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #800;" class=3D"styled-by-prettify">//A</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">template</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">class</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> T</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">class</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">...</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #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"> </span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">void</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> foo</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">(</span><span style=3D"color: #606;" class=3D"styled-by-prettify">A=
rgs</span><span style=3D"color: #660;" class=3D"styled-by-prettify">...,</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> T</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=
: #800;" class=3D"styled-by-prettify">//B</span></font></div></code></div><=
br>calling <div class=3D"prettyprint" style=3D"border: 1px solid rgb(187, 1=
87, 187); word-wrap: break-word; background-color: rgb(250, 250, 250);"><co=
de class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color=
: #000;" class=3D"styled-by-prettify">foo</span><span style=3D"color: #660;=
" 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"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">2</=
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: #066;" class=3D"styled-by-prettify">3</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">)</span></div></code></div><br> today=
 unambiguously calls overload A, whereas if we allow B to be deduced the ca=
ll becomes ambiguous. =C2=A0However, I doubt such code exist as there seems=
 to be no way of calling B.<br><br>On Saturday, 27 February 2016 14:15:30 U=
TC, NDos Dannyu  wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0=
;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div di=
r=3D"ltr"><br><br>2016=EB=85=84 2=EC=9B=94 26=EC=9D=BC =EA=B8=88=EC=9A=94=
=EC=9D=BC =EC=98=A4=EC=A0=84 3=EC=8B=9C 9=EB=B6=84 1=EC=B4=88 UTC+9, <a>bru=
no....@gmail.com</a> =EB=8B=98=EC=9D=98 =EB=A7=90:<blockquote class=3D"gmai=
l_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;pad=
ding-left:1ex"><div dir=3D"ltr"><span><p style=3D"line-height:1.38;margin-t=
op:0pt;margin-bottom:0pt" dir=3D"ltr"><span style=3D"font-size:14.6667px;fo=
nt-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wr=
ap;background-color:transparent">Hello,</span></p><br><p style=3D"line-heig=
ht:1.38;margin-top:0pt;margin-bottom:0pt" dir=3D"ltr"><span style=3D"font-s=
ize:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;wh=
ite-space:pre-wrap;background-color:transparent">Parameter packs are alread=
y allowed to appear anywhere a function parameter list, but can only be ded=
uced if they appear in the rightmost position.</span></p><br><p style=3D"li=
ne-height:1.38;margin-top:0pt;margin-bottom:0pt" dir=3D"ltr"><span style=3D=
"font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:base=
line;white-space:pre-wrap;background-color:transparent">I was wondering wha=
t the opinions are about allowing type deduction to be performed on a funct=
ion template whose parameter pack is not at the end of the function paramet=
er list, allowing for example</span></p><br><div style=3D"border:1px solid =
rgb(187,187,187);word-wrap:break-word;background-color:rgb(250,250,250)"><c=
ode><div><span style=3D"color:#008">template</span><span style=3D"color:#66=
0">&lt;</span><span style=3D"color:#008">class</span><span style=3D"color:#=
660">...</span><span style=3D"color:#000"> </span><span style=3D"color:#606=
">Args</span><span style=3D"color:#660">,</span><span style=3D"color:#000">=
 </span><span style=3D"color:#008">class</span><span style=3D"color:#000"> =
T</span><span style=3D"color:#660">&gt;</span><span style=3D"color:#000"><b=
r>T get_pack_last</span><span style=3D"color:#660">(</span><span style=3D"c=
olor:#606">Args</span><span style=3D"color:#660">...,</span><span style=3D"=
color:#000"> T t</span><span style=3D"color:#660">)</span><span style=3D"co=
lor:#000"><br></span><span style=3D"color:#660">{</span><span style=3D"colo=
r:#000"><br>=C2=A0 =C2=A0 =C2=A0</span><span style=3D"color:#008">return</s=
pan><span style=3D"color:#000"> t</span><span style=3D"color:#660">;</span>=
<span style=3D"color:#000"><br></span><span style=3D"color:#660">}</span></=
div></code></div><p style=3D"line-height:1.38;margin-top:0pt;margin-bottom:=
0pt" dir=3D"ltr"><br></p><p style=3D"line-height:1.38;margin-top:0pt;margin=
-bottom:0pt" dir=3D"ltr"><span style=3D"font-size:14.6667px;font-family:Ari=
al;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background=
-color:transparent">to compile without having to provide template arguments=
 for the pack at the call site.</span><span style=3D"font-size:14.6667px;fo=
nt-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wr=
ap;background-color:transparent"><br></span><span style=3D"font-size:14.666=
7px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:=
pre-wrap;background-color:transparent"><br></span><span style=3D"font-size:=
14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-=
space:pre-wrap;background-color:transparent">A limitation would be that the=
 deduction would fail if the parameter list contains any default arguments =
or if more than one parameter pack is present</span></p><br><p style=3D"lin=
e-height:1.38;margin-top:0pt;margin-bottom:0pt" dir=3D"ltr"><span style=3D"=
font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:basel=
ine;white-space:pre-wrap;background-color:transparent">Note that ambiguitie=
s such as</span><span style=3D"font-size:14.6667px;font-family:Arial;color:=
rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:tr=
ansparent"><br></span><span style=3D"font-size:14.6667px;font-family:Arial;=
color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-co=
lor:transparent"></span></p><div style=3D"border:1px solid rgb(187,187,187)=
;word-wrap:break-word;background-color:rgb(250,250,250)"><code><div><span s=
tyle=3D"color:#008">template</span><span style=3D"color:#660">&lt;</span><s=
pan style=3D"color:#008">class</span><span style=3D"color:#660">...</span><=
span style=3D"color:#000"> </span><span style=3D"color:#606">Args</span><sp=
an style=3D"color:#660">&gt;</span><span style=3D"color:#000"><br></span><s=
pan style=3D"color:#008">void</span><span style=3D"color:#000"> foo</span><=
span style=3D"color:#660">(</span><span style=3D"color:#008">int</span><spa=
n style=3D"color:#660">,</span><span style=3D"color:#000"> </span><span sty=
le=3D"color:#606">Args</span><span style=3D"color:#660">=E2=80=A6);</span><=
span style=3D"color:#000"><br><br></span><span style=3D"color:#008">templat=
e</span><span style=3D"color:#660">&lt;</span><span style=3D"color:#008">cl=
ass</span><span style=3D"color:#660">...</span><span style=3D"color:#000"> =
</span><span style=3D"color:#606">Args</span><span style=3D"color:#660">&gt=
;</span><span style=3D"color:#000"><br></span><span style=3D"color:#008">vo=
id</span><span style=3D"color:#000"> foo</span><span style=3D"color:#660">(=
</span><span style=3D"color:#606">Args</span><span style=3D"color:#660">=E2=
=80=A6,</span><span style=3D"color:#000"> </span><span style=3D"color:#008"=
>int</span><span style=3D"color:#660">);</span><span style=3D"color:#000"><=
br><br><br>foo</span><span style=3D"color:#660">&lt;</span><span style=3D"c=
olor:#008">int</span><span style=3D"color:#660">,</span><span style=3D"colo=
r:#000"> </span><span style=3D"color:#008">int</span><span style=3D"color:#=
660">,</span><span style=3D"color:#000"> </span><span style=3D"color:#008">=
int</span><span style=3D"color:#660">&gt;(</span><span style=3D"color:#066"=
>1</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#066">2</span><span style=3D"color:#660">,</span><=
span style=3D"color:#000"> </span><span style=3D"color:#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></div></code></div><p style=3D"line-height:1.38;margin-=
top:0pt;margin-bottom:0pt" dir=3D"ltr"><span style=3D"font-size:14.6667px;f=
ont-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-w=
rap;background-color:transparent"><br></span></p><p style=3D"line-height:1.=
38;margin-top:0pt;margin-bottom:0pt" dir=3D"ltr"><span style=3D"font-size:1=
4.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-s=
pace:pre-wrap;background-color:transparent">already exist. This code, for e=
xample, produces an ambiguous call error in clang, whereas gcc selects the =
first overload (I am not sure who=E2=80=99s right here, though it seems to =
me that an ambiguous error is more appropriate). </span></p><br><p style=3D=
"line-height:1.38;margin-top:0pt;margin-bottom:0pt" dir=3D"ltr"><span style=
=3D"font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertical-align:b=
aseline;white-space:pre-wrap;background-color:transparent">Thus</span></p><=
p style=3D"line-height:1.38;margin-top:0pt;margin-bottom:0pt" dir=3D"ltr"><=
span style=3D"font-size:14.6667px;font-family:Arial;color:rgb(0,0,0);vertic=
al-align:baseline;white-space:pre-wrap;background-color:transparent"></span=
></p><div style=3D"border:1px solid rgb(187,187,187);word-wrap:break-word;b=
ackground-color:rgb(250,250,250)"><code><div><span style=3D"color:#000">foo=
</span><span style=3D"color:#660">(</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:#066">2</span><span style=3D"color:#660">,</span><span st=
yle=3D"color:#000"> </span><span style=3D"color:#066">3</span><span style=
=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#066">4</span><span style=3D"color:#660">);</span></div></code></div><=
/span><p></p><p style=3D"line-height:1.38;margin-top:0pt;margin-bottom:0pt"=
 dir=3D"ltr"><span style=3D"font-size:14.6667px;font-family:Arial;color:rgb=
(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-color:trans=
parent"><br></span></p><p style=3D"line-height:1.38;margin-top:0pt;margin-b=
ottom:0pt" dir=3D"ltr"><span style=3D"font-size:14.6667px;font-family:Arial=
;color:rgb(0,0,0);vertical-align:baseline;white-space:pre-wrap;background-c=
olor:transparent">should have the right to be just as ambiguous :)</span></=
p><br><p style=3D"line-height:1.38;margin-top:0pt;margin-bottom:0pt" dir=3D=
"ltr"><span style=3D"font-size:14.6667px;font-family:Arial;color:rgb(0,0,0)=
;vertical-align:baseline;white-space:pre-wrap;background-color:transparent"=
>A couple of =C2=A0toy use cases are:</span><span style=3D"font-size:14.666=
7px;font-family:Arial;color:rgb(0,0,0);vertical-align:baseline;white-space:=
pre-wrap;background-color:transparent"><br></span><span style=3D"font-size:=
12px;font-family:Arial;color:rgb(20,24,35);vertical-align:baseline;white-sp=
ace:pre-wrap;background-color:rgb(246,247,248)"></span></p><div style=3D"bo=
rder:1px solid rgb(187,187,187);word-wrap:break-word;background-color:rgb(2=
50,250,250)"><code><div><span style=3D"color:#008">template</span><span sty=
le=3D"color:#000"> </span><span style=3D"color:#660">&lt;</span><span style=
=3D"color:#008">class</span><span style=3D"color:#660">...</span><span styl=
e=3D"color:#606">Args</span><span style=3D"color:#660">&gt;</span><span sty=
le=3D"color:#000"><br></span><span style=3D"color:#008">auto</span><span st=
yle=3D"color:#000"> alternate</span><span style=3D"color:#660">(</span><spa=
n style=3D"color:#606">Args</span><span style=3D"color:#660">...</span><spa=
n style=3D"color:#000"> args</span><span style=3D"color:#660">)</span><span=
 style=3D"color:#000"><br></span><span style=3D"color:#660">{</span><span s=
tyle=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0</span><span style=3D"color:#00=
8">return</span><span style=3D"color:#000"> make_tuple</span><span style=3D=
"color:#660">(</span><span style=3D"color:#000">args</span><span style=3D"c=
olor:#660">...);</span><span style=3D"color:#000"><br></span><span style=3D=
"color:#660">}</span><span style=3D"color:#000"><br><br></span><span style=
=3D"color:#008">template</span><span style=3D"color:#660">&lt;</span><span =
style=3D"color:#000"> </span><span style=3D"color:#008">class</span><span s=
tyle=3D"color:#000"> </span><span style=3D"color:#606">First</span><span st=
yle=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=
=3D"color:#008">class</span><span style=3D"color:#660">...</span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#606">Rest</span><span style=
=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#008">class</span><span style=3D"color:#000"> </span><span style=3D"co=
lor:#606">Last</span><span style=3D"color:#660">&gt;</span><span style=3D"c=
olor:#000"><br></span><span style=3D"color:#008">auto</span><span style=3D"=
color:#000"> alternate</span><span style=3D"color:#660">(</span><span style=
=3D"color:#606">First</span><span style=3D"color:#000"> first</span><span s=
tyle=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=
=3D"color:#606">Rest</span><span style=3D"color:#660">...</span><span style=
=3D"color:#000"> rest</span><span style=3D"color:#660">,</span><span style=
=3D"color:#000"> </span><span style=3D"color:#606">Last</span><span style=
=3D"color:#000"> </span><span style=3D"color:#008">last</span><span style=
=3D"color:#660">)</span><span style=3D"color:#000"><br></span><span style=
=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0=
</span><span style=3D"color:#008">return</span><span style=3D"color:#000"> =
tuple_cat</span><span style=3D"color:#660">(</span><span style=3D"color:#00=
0">make_tuple</span><span style=3D"color:#660">(</span><span style=3D"color=
:#000">first</span><span style=3D"color:#660">,</span><span style=3D"color:=
#000"> </span><span style=3D"color:#008">last</span><span style=3D"color:#6=
60">),</span><span style=3D"color:#000"> alternate</span><span style=3D"col=
or:#660">(</span><span style=3D"color:#000">rest</span><span style=3D"color=
:#660">...));</span><span style=3D"color:#000"><br></span><span style=3D"co=
lor:#660">}</span></div></code></div><p style=3D"line-height:1.38;margin-to=
p:0pt;margin-bottom:0pt" dir=3D"ltr"><br></p><br><div style=3D"border:1px s=
olid rgb(187,187,187);word-wrap:break-word;background-color:rgb(250,250,250=
)"><code><div><span style=3D"color:#008">template</span><span style=3D"colo=
r:#000"> </span><span style=3D"color:#660">&lt;</span><span style=3D"color:=
#008">class</span><span style=3D"color:#660">=E2=80=A6</span><span style=3D=
"color:#000"> </span><span style=3D"color:#606">Args</span><span style=3D"c=
olor:#660">&gt;</span><span style=3D"color:#000"><br></span><span style=3D"=
color:#008">bool</span><span style=3D"color:#000"> ends_with_bool_char</spa=
n><span style=3D"color:#660">(</span><span style=3D"color:#606">Args</span>=
<span style=3D"color:#660">=E2=80=A6)</span><span style=3D"color:#000"><br>=
</span><span style=3D"color:#660">{</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 =C2=A0</span><span style=3D"color:#008">return</span><span st=
yle=3D"color:#000"> </span><span style=3D"color:#008">false</span><span sty=
le=3D"color:#660">;</span><span style=3D"color:#000"><br></span><span style=
=3D"color:#660">}</span><span style=3D"color:#000"><br><br></span><span sty=
le=3D"color:#008">template</span><span style=3D"color:#660">-&lt;</span><sp=
an style=3D"color:#008">class</span><span style=3D"color:#660">=E2=80=A6</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#606">Args</spa=
n><span style=3D"color:#660">&gt;</span><span style=3D"color:#000"><br></sp=
an><span style=3D"color:#008">bool</span><span style=3D"color:#000"> ends_w=
ith_bool_char</span><span style=3D"color:#660">(</span><span style=3D"color=
:#606">Args</span><span style=3D"color:#660">=E2=80=A6,</span><span style=
=3D"color:#000"> </span><span style=3D"color:#008">bool</span><span style=
=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#008">char</span><span style=3D"color:#660">)</span><span style=3D"col=
or:#000"><br></span><span style=3D"color:#660">{</span><span style=3D"color=
:#000"><br>=C2=A0 =C2=A0 =C2=A0</span><span style=3D"color:#008">return</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#008">true</span=
><span style=3D"color:#660">;</span><span style=3D"color:#000"><br></span><=
span style=3D"color:#660">}</span></div></code><br></div></div></blockquote=
><div><div><br></div><div>Function parameter packs are allowed=C2=A0to appe=
ar=C2=A0at any position.</div><div>Template parameter packs=C2=A0can only a=
ppear at the rightmost position.=C2=A0</div>=C2=A0</div></div></blockquote>=
</div></div></div>

<p></p>

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

------=_Part_1740_591484258.1456594488775--
------=_Part_1739_711275109.1456594488774--

.