Topic: Is there any proposal in the pipeline to allow
Author: adrian.hawryluk@gmail.com
Date: Sat, 9 Dec 2017 12:21:07 -0800 (PST)
Raw View
------=_Part_1997_682719282.1512850867280
Content-Type: multipart/alternative;
boundary="----=_Part_1998_1479441497.1512850867280"
------=_Part_1998_1479441497.1512850867280
Content-Type: text/plain; charset="UTF-8"
This would abide by current parameter pack expansion rules.
--
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/e88e6be1-62e4-48b1-8d9f-e731d268a4e9%40isocpp.org.
------=_Part_1998_1479441497.1512850867280
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">This would abide by current parameter pack expansion rules=
..</div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/e88e6be1-62e4-48b1-8d9f-e731d268a4e9%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/e88e6be1-62e4-48b1-8d9f-e731d268a4e9=
%40isocpp.org</a>.<br />
------=_Part_1998_1479441497.1512850867280--
------=_Part_1997_682719282.1512850867280--
.
Author: Adrian Hawryluk <adrian.hawryluk@gmail.com>
Date: Sat, 9 Dec 2017 17:19:49 -0500
Raw View
--001a114b66b4157389055fefb34b
Content-Type: text/plain; charset="UTF-8"
Apologies for the weird font size. Not sure why it's mega huge. I'll repost
in a smaller fontwhen I get the chance.
On Dec 9, 2017 15:21, <adrian.hawryluk@gmail.com> wrote:
This would abide by current parameter pack expansion rules.
--
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/CAP_kE8VXP%3D2wVN_4ih4ejAQdYYkop8mB_q0B5-souRd%2BziSxhw%40mail.gmail.com.
--001a114b66b4157389055fefb34b
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"auto">Apologies for the weird font size. Not sure why it's =
mega huge. I'll repost in a smaller fontwhen I get the chance.</div><di=
v class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Dec 9, 2017 15:21=
, <<a href=3D"mailto:adrian.hawryluk@gmail.com">adrian.hawryluk@gmail.c=
om</a>> wrote:<br type=3D"attribution"><blockquote class=3D"quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=
=3D"ltr">This would abide by current parameter pack expansion rules.</div><=
/blockquote></div><br></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAP_kE8VXP%3D2wVN_4ih4ejAQdYYkop8mB_q=
0B5-souRd%2BziSxhw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAP_kE8VXP%3D=
2wVN_4ih4ejAQdYYkop8mB_q0B5-souRd%2BziSxhw%40mail.gmail.com</a>.<br />
--001a114b66b4157389055fefb34b--
.
Author: adrian.hawryluk@gmail.com
Date: Sat, 9 Dec 2017 16:30:55 -0800 (PST)
Raw View
------=_Part_2678_879214057.1512865855299
Content-Type: multipart/alternative;
boundary="----=_Part_2679_715674969.1512865855299"
------=_Part_2679_715674969.1512865855299
Content-Type: text/plain; charset="UTF-8"
Sorry about the weird font size of message at the beginning of the thread.
I had written it on my phone. The following is an up to date copy of what
I propose with significant edits:
The problem with templates is that you must specify a particular TPTs
(template parameter types) you want as a parameter, such as a *typename*, a
*template* or a *value*. However, you can't say, specialize the template
based on if the next parameter is any of those three.
I propose that there be a way to specialize based on these parameters like
in the following example:
template <...Xs>
struct X;
template <template <typename...> class TT>
struct X<TT> {};
template <typename T>
struct X<T> {};
template <typename T, T I>
struct X<I> {};
// Or the last one could be stated as this, now
// that auto can be used in templates parameters:
template <auto I>
struct X<I> {};
The previous example is a simple representation of a template that takes a
parameter pack of unspecified TPTs, and is only accessible though
specialization, just like how all parameter packs are. More complex usage
is would be available as the untyped template parameter pack is available
to be used like any parameter pack. Such a UTPP would not be valid in all
contexts of course, but that would go the same for typed template parameter
packs, and the same rules would apply.
Having this would allow unconstrained, but type safe, traversal of any
list, regardless of what the template parameter list is composed of, and
allow the making of generic transforms.
--
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/763150bc-ba16-491e-b199-5867a5a17a84%40isocpp.org.
------=_Part_2679_715674969.1512865855299
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>Sorry about the weird font size of message at the beg=
inning of the thread.=C2=A0 I had written it on my phone.=C2=A0 The followi=
ng is an up to date copy of what I propose with significant edits:</div><di=
v><br></div>The problem with templates is that you must specify a particula=
r TPTs (template parameter types) you want as a parameter, such as a <b>typ=
ename</b>, a <b>template</b>=C2=A0or a <b>value</b>. However, you can'=
t say, specialize the template based on if the next parameter is any of tho=
se three.<br><br>I propose that there be a way to specialize based on these=
parameters like in the following example:<div><br><div><div></div></div><d=
iv class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); bor=
der-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; word=
-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subprettyprin=
t"><span style=3D"color: #000;" class=3D"styled-by-prettify">=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><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify"><...</span><span s=
tyle=3D"color: #606;" class=3D"styled-by-prettify">Xs</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">></span><span style=3D"color:=
#000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> X</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" cla=
ss=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;" cl=
ass=3D"styled-by-prettify"><</span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">template</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-=
prettify"><</span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">typename</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">class</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> TT</span><span=
style=3D"color: #660;" class=3D"styled-by-prettify">></span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> X</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color:=
#000;" class=3D"styled-by-prettify">TT</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-pr=
ettify"><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"st=
yled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify"><</span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">typename</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> T</span><span style=3D"color: #660;" class=3D"styled-by-prettify">></s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =
=C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">str=
uct</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> X</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><spa=
n 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"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;" 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"><</span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">typename</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> T</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> T I</span><span style=3D"color: #660;" class=3D"styled-by-prettify">><=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =
=C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">str=
uct</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> X</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">I</span><span style=
=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;" clas=
s=3D"styled-by-prettify"><br><br>=C2=A0 =C2=A0 </span><span style=3D"color:=
#800;" class=3D"styled-by-prettify">// Or the last one could be stated as =
this, now </span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br>=C2=A0 =C2=A0 </span><span style=3D"color: #800;" class=3D"styled-by-pr=
ettify">// that auto can be used in templates parameters:</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">template</span><font=
color=3D"#666600"><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> I</span><span styl=
e=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 </span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> X</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">I</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">></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></font><font color=3D"#666600"></font></div></code></div=
><div><br></div><div>The previous example is a simple representation of a t=
emplate that takes a parameter pack of unspecified TPTs, and is only access=
ible though specialization, just like how all parameter packs are.=C2=A0 Mo=
re complex usage is would be available as the untyped template parameter pa=
ck is available to be used like any parameter pack.=C2=A0 Such a UTPP would=
not be valid in all contexts of course, but that would go the same for typ=
ed template parameter packs, and the same rules would apply.<br></div><div>=
<br></div><div>Having this would allow unconstrained, but type safe, traver=
sal of any list, regardless of what the template parameter list is composed=
of, and allow the making of generic transforms.</div></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/763150bc-ba16-491e-b199-5867a5a17a84%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/763150bc-ba16-491e-b199-5867a5a17a84=
%40isocpp.org</a>.<br />
------=_Part_2679_715674969.1512865855299--
------=_Part_2678_879214057.1512865855299--
.
Author: bastienpenava@gmail.com
Date: Sat, 9 Dec 2017 20:37:54 -0800 (PST)
Raw View
------=_Part_2998_1089452649.1512880674826
Content-Type: multipart/alternative;
boundary="----=_Part_2999_901529367.1512880674826"
------=_Part_2999_901529367.1512880674826
Content-Type: text/plain; charset="UTF-8"
On Sunday, December 10, 2017 at 1:30:55 AM UTC+1, adrian....@gmail.com
wrote:
>
> Sorry about the weird font size of message at the beginning of the
> thread. I had written it on my phone. The following is an up to date copy
> of what I propose with significant edits:
>
> The problem with templates is that you must specify a particular TPTs
> (template parameter types) you want as a parameter, such as a *typename*,
> a *template* or a *value*. However, you can't say, specialize the
> template based on if the next parameter is any of those three.
>
> I propose that there be a way to specialize based on these parameters like
> in the following example:
>
> template <...Xs>
> struct X;
>
> template <template <typename...> class TT>
> struct X<TT> {};
>
> template <typename T>
> struct X<T> {};
>
> template <typename T, T I>
> struct X<I> {};
>
> // Or the last one could be stated as this, now
> // that auto can be used in templates parameters:
> template <auto I>
> struct X<I> {};
>
> The previous example is a simple representation of a template that takes a
> parameter pack of unspecified TPTs, and is only accessible though
> specialization, just like how all parameter packs are. More complex usage
> is would be available as the untyped template parameter pack is available
> to be used like any parameter pack. Such a UTPP would not be valid in all
> contexts of course, but that would go the same for typed template parameter
> packs, and the same rules would apply.
>
> Having this would allow unconstrained, but type safe, traversal of any
> list, regardless of what the template parameter list is composed of, and
> allow the making of generic transforms.
>
No official proposal yet but I already started a thread about it here:
https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/sZZ-Weg-kUA
Also your syntax doesn't allow for non-variadic generic template parameter.
--
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/2c7dc4dc-4677-42e4-8605-cedc50c6a7b3%40isocpp.org.
------=_Part_2999_901529367.1512880674826
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Sunday, December 10, 2017 at 1:30:55 AM UTC+1, adrian..=
...@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;mar=
gin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D=
"ltr"><div>Sorry about the weird font size of message at the beginning of t=
he thread.=C2=A0 I had written it on my phone.=C2=A0 The following is an up=
to date copy of what I propose with significant edits:</div><div><br></div=
>The problem with templates is that you must specify a particular TPTs (tem=
plate parameter types) you want as a parameter, such as a <b>typename</b>, =
a <b>template</b>=C2=A0or a <b>value</b>. However, you can't say, spec=
ialize the template based on if the next parameter is any of those three.<b=
r><br>I propose that there be a way to specialize based on these parameters=
like in the following example:<div><br><div><div></div></div><div style=3D=
"background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-sty=
le:solid;border-width:1px;word-wrap:break-word"><code><div><span style=3D"c=
olor:#000">=C2=A0 =C2=A0 </span><span style=3D"color:#008">template</span><=
span style=3D"color:#000"> </span><span style=3D"color:#660"><...</span>=
<span style=3D"color:#606">Xs</span><span style=3D"color:#660">></span><=
span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#00=
8">struct</span><span style=3D"color:#000"> X</span><span style=3D"color:#6=
60">;</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 </span><span s=
tyle=3D"color:#008">template</span><span style=3D"color:#000"> </span><span=
style=3D"color:#660"><</span><span style=3D"color:#008">template</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#660"><</span><s=
pan style=3D"color:#008">typename</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"> TT</span><span style=3D"color:#660">></=
span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"col=
or:#008">struct</span><span style=3D"color:#000"> X</span><span style=3D"co=
lor:#660"><</span><span style=3D"color:#000">TT</span><span style=3D"col=
or:#660">></span><span style=3D"color:#000"> </span><span style=3D"color=
:#660">{};</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 </span><s=
pan style=3D"color:#008">template</span><span style=3D"color:#000"> </span>=
<span style=3D"color:#660"><</span><span style=3D"color:#008">typename</=
span><span style=3D"color:#000"> T</span><span style=3D"color:#660">></s=
pan><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"colo=
r:#008">struct</span><span style=3D"color:#000"> X</span><span style=3D"col=
or:#660"><</span><span style=3D"color:#000">T</span><span style=3D"color=
:#660">></span><span style=3D"color:#000"> </span><span style=3D"color:#=
660">{};</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 </span><spa=
n style=3D"color:#008">template</span><span style=3D"color:#000"> </span><s=
pan style=3D"color:#660"><</span><span style=3D"color:#008">typename</sp=
an><span style=3D"color:#000"> T</span><span style=3D"color:#660">,</span><=
span style=3D"color:#000"> T I</span><span style=3D"color:#660">></span>=
<span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#0=
08">struct</span><span style=3D"color:#000"> X</span><span style=3D"color:#=
660"><</span><span style=3D"color:#000">I</span><span style=3D"color:#66=
0">></span><span style=3D"color:#000"> </span><span style=3D"color:#660"=
>{};</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 </span><span st=
yle=3D"color:#800">// Or the last one could be stated as this, now </span><=
span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#80=
0">// that auto can be used in templates parameters:</span><span style=3D"c=
olor:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">template</sp=
an><font color=3D"#666600"><span style=3D"color:#000"> </span><span style=
=3D"color:#660"><</span><span style=3D"color:#008">auto</span><span styl=
e=3D"color:#000"> I</span><span style=3D"color:#660">></span><span style=
=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">struct<=
/span><span style=3D"color:#000"> X</span><span style=3D"color:#660"><</=
span><span style=3D"color:#000">I</span><span style=3D"color:#660">></sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#660">{};</span>=
</font><font color=3D"#666600"></font></div></code></div><div><br></div><di=
v>The previous example is a simple representation of a template that takes =
a parameter pack of unspecified TPTs, and is only accessible though special=
ization, just like how all parameter packs are.=C2=A0 More complex usage is=
would be available as the untyped template parameter pack is available to =
be used like any parameter pack.=C2=A0 Such a UTPP would not be valid in al=
l contexts of course, but that would go the same for typed template paramet=
er packs, and the same rules would apply.<br></div><div><br></div><div>Havi=
ng this would allow unconstrained, but type safe, traversal of any list, re=
gardless of what the template parameter list is composed of, and allow the =
making of generic transforms.</div></div></div></blockquote><div><br></div>=
<div>No official proposal yet but I already started a thread about it here:=
<a href=3D"https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposa=
ls/sZZ-Weg-kUA"> https://groups.google.com/a/isocpp.org/forum/#!topic/std-p=
roposals/sZZ-Weg-kUA</a></div><div>Also your syntax doesn't allow for n=
on-variadic generic template parameter.</div><div><br></div><div><br></div>=
<div><br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/2c7dc4dc-4677-42e4-8605-cedc50c6a7b3%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/2c7dc4dc-4677-42e4-8605-cedc50c6a7b3=
%40isocpp.org</a>.<br />
------=_Part_2999_901529367.1512880674826--
------=_Part_2998_1089452649.1512880674826--
.
Author: adrian.hawryluk@gmail.com
Date: Sat, 9 Dec 2017 21:33:36 -0800 (PST)
Raw View
------=_Part_3231_1129478223.1512884016888
Content-Type: multipart/alternative;
boundary="----=_Part_3232_727272150.1512884016888"
------=_Part_3232_727272150.1512884016888
Content-Type: text/plain; charset="UTF-8"
>
> No official proposal yet but I already started a thread about it here:
> https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/sZZ-Weg-kUA
>
Good to know.
> Also your syntax doesn't allow for non-variadic generic template parameter.
>
The syntax I proposed was to be compatible with the current syntax. I had
considered using *auto*, but unfortunately, that has already been taken.
Access to the *any TPT* would require specialization so that it would be
able to be determined, and is why I chose the variadic template route as
they already need to be specialized.
--
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/090f2c08-6bb9-410a-b2c9-c3aad79b99a4%40isocpp.org.
------=_Part_3232_727272150.1512884016888
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;bor=
der-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div>No offic=
ial proposal yet but I already started a thread about it here:<a href=3D"ht=
tps://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/sZZ-Weg-kU=
A" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'https=
://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/sZZ-Weg-kUA&#=
39;;return true;" onclick=3D"this.href=3D'https://groups.google.com/a/i=
socpp.org/forum/#!topic/std-proposals/sZZ-Weg-kUA';return true;"> https=
://groups.google.com/a/<wbr>isocpp.org/forum/#!topic/std-<wbr>proposals/sZZ=
-Weg-kUA</a><br></div><div></div></div></blockquote><div><br></div><div>Goo=
d to know.</div><div>=C2=A0</div><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"><div>Also your syntax doesn't allow for non-variadi=
c generic template parameter.</div></div></blockquote><div><br></div><div>T=
he syntax I proposed was to be compatible with the current syntax.=C2=A0 I =
had considered using <b>auto</b>, but unfortunately, that has already been =
taken. Access to the <i>any TPT</i>=C2=A0would require specialization so th=
at it would be able to be determined, and is why I chose the variadic templ=
ate route as they already need to be specialized.=C2=A0</div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/090f2c08-6bb9-410a-b2c9-c3aad79b99a4%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/090f2c08-6bb9-410a-b2c9-c3aad79b99a4=
%40isocpp.org</a>.<br />
------=_Part_3232_727272150.1512884016888--
------=_Part_3231_1129478223.1512884016888--
.
Author: adrian.hawryluk@gmail.com
Date: Sun, 10 Dec 2017 07:06:57 -0800 (PST)
Raw View
------=_Part_4376_1436409368.1512918417397
Content-Type: multipart/alternative;
boundary="----=_Part_4377_1648065044.1512918417398"
------=_Part_4377_1648065044.1512918417398
Content-Type: text/plain; charset="UTF-8"
A further alternative would be to have a placeholder and specialize on that:
// Can't define a template with a placeholder TPT
template <placeholder>
struct X;
template <template <typename...> class TT>
struct X<TT> {};
template <typename T>
struct X<T> {};
template <typename T, T I>
struct X<I> {};
template <auto I>
struct X<I> {};
That would be useful to make it clear that a particular number of
parameters is required on the top level. Note that this is syntactic
sugar, and is not really needed to make UTPTs work, but does make it easier
to code and perhaps read. I used a possible contextual keyword
*placeholder*, but it is possible that just a blank TPT could also be used
instead. The only possible issue with that is it might be missed upon
first reading of the code by a human, and maybe misconstrued as a template
specialization. Example:
// Not a template specialization but a template with a single UTPT
template <>
struct X0;
// A template with two consecutive UTPT
template <,>
struct X1;
// A template with constant, a UTPT, and a type
template <auto I, , typename T>
struct X2;
Requiring the use of a contextual keyword would make it clearer of meaning:
// Not a template specialization but a template with a single UTPT
template <placeholder>
struct X0;
// A template with two consecutive UTPT
template <placeholder, placeholder>
struct X1;
// A template with constant, a UTPT, and a type
template <auto I, placeholder, typename T>
struct X2;
Although, if it is made optional/not needed, one could use a comment
instead for readability:
// Not a template specialization but a template with a single UTPT
template </*placeholder*/>
struct X0;
// A template with two consecutive UTPT
template </*placeholder*/, /*placeholder*/>
struct X1;
// A template with constant, a UTPT, and a type
template <auto I, /*placeholder*/, typename T>
struct X2;
Currently, all contexts that I've stated are currently illegal, including
the UTPT parameter pack, so would not impact current code in the wild.
--
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/3d87d05f-a455-4c0c-8085-36542315e870%40isocpp.org.
------=_Part_4377_1648065044.1512918417398
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">A further alternative would be to have a placeholder and s=
pecialize on that:<div><br></div><div class=3D"prettyprint" style=3D"backgr=
ound-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-st=
yle: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"prett=
yprint"><div class=3D"subprettyprint"><span style=3D"color: #000;" class=3D=
"styled-by-prettify">=C2=A0 =C2=A0 </span><span style=3D"color: #800;" clas=
s=3D"styled-by-prettify">// Can't define a template with a placeholder =
TPT</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=
=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>template</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #080;" class=3D"styled-by-prettify"><placeh=
older></span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">struct</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> X</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>=C2=A0=
=C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">te=
mplate</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">template</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">...></span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">class</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> TT</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">></span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">struct</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> X</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify"><</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
>TT</span><span style=3D"color: #660;" class=3D"styled-by-prettify">></s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
style=3D"color: #660;" class=3D"styled-by-prettify">{};</span><span style=
=3D"color: #000;" class=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 styl=
e=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">></span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">struct</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"> X</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify"><</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify">T</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">></span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{};</s=
pan><span style=3D"color: #000;" class=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;" class=3D"styled-by-prettify"><</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 sty=
le=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> T I</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">></span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: =
#008;" class=3D"styled-by-prettify">struct</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> X</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify"><</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify">I</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">></span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{};</s=
pan><span style=3D"color: #000;" class=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;" class=3D"styled-by-prettify"><</span=
><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</span><span=
style=3D"color: #000;" class=3D"styled-by-prettify"> I</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">></span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> X</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">I</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">></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=
"><br></span></div></code></div><div><br></div><div>That would be useful to=
make it clear that a particular number of parameters is required on the to=
p level.=C2=A0 Note that this is syntactic sugar, and is not really needed =
to make UTPTs work, but does make it easier to code and perhaps read.=C2=A0=
I used a possible contextual keyword <b>placeholder</b>, but it is possibl=
e that just a blank TPT could also be used instead.=C2=A0 The only possible=
issue with that is it might be missed upon first reading of the code by a =
human, and maybe misconstrued as a template specialization.=C2=A0 Example:<=
/div><div><br></div><div class=3D"prettyprint" style=3D"background-color: r=
gb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; b=
order-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div =
class=3D"subprettyprint"><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">=C2=A0 =C2=A0 </span><span style=3D"color: #800;" class=3D"styled-b=
y-prettify">// Not a template specialization but a template with a single U=
TPT</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=
=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>template</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #660;" class=3D"styled-by-prettify"><></=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =
=C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">str=
uct</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> X0</sp=
an><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 =C2=A0 <=
/span><span style=3D"color: #800;" class=3D"styled-by-prettify">// A templa=
te with two consecutive UTPT</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">template</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-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> X1</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"><br><br>=C2=A0 =C2=A0 </span><span style=3D"color: #800;" class=3D"styl=
ed-by-prettify">// A template with constant, a UTPT, and a type</span><span=
style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">template</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D=
"color: #008;" class=3D"styled-by-prettify">auto</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> I</span><span style=3D"color: #660;"=
class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">typena=
me</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-prettify"><br>=C2=A0 =C2=A0 </sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> X2</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br></span></div></code></div><div=
><br>Requiring the use of a contextual keyword would make it clearer of mea=
ning:<br><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250=
, 250); border-color: rgb(187, 187, 187); border-style: solid; border-width=
: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"su=
bprettyprint"><span style=3D"color: #000;" class=3D"styled-by-prettify">=C2=
=A0 =C2=A0 </span><span style=3D"color: #800;" class=3D"styled-by-prettify"=
>// Not a template specialization but a template with a single UTPT</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">template</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #080;" class=3D"styled-by-prettify"><placeholder</span=
><span style=3D"color: #080;" class=3D"styled-by-prettify">></span><span=
style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> X0</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br><br>=C2=A0 =C2=A0 </span><span=
style=3D"color: #800;" class=3D"styled-by-prettify">// A template with two=
consecutive UTPT</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">template</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy"><</span><span style=3D"color: rgb(0, 136, 0); font-family: Arial, He=
lvetica, sans-serif;">placeholder</span><span style=3D"color: rgb(102, 102,=
0); font-family: Arial, Helvetica, sans-serif;">,=C2=A0</span><span style=
=3D"color: rgb(0, 136, 0); font-family: Arial, Helvetica, sans-serif;">plac=
eholder</span><span style=3D"color: rgb(102, 102, 0); font-family: Arial, H=
elvetica, sans-serif;">></span></div><div class=3D"subprettyprint"><span=
style=3D"color: #000;" class=3D"styled-by-prettify">=C2=A0 =C2=A0 </span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span=
style=3D"color: #000;" class=3D"styled-by-prettify"> X1</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 =C2=A0 </span><span st=
yle=3D"color: #800;" class=3D"styled-by-prettify">// A template with consta=
nt, a UTPT, and a type</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><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"st=
yled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify"><</span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">auto</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> I<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify">=C2=A0</span><span s=
tyle=3D"color: rgb(0, 136, 0); font-family: Arial, Helvetica, sans-serif;">=
placeholder</span><span class=3D"styled-by-prettify" style=3D"font-family: =
Arial, Helvetica, sans-serif; color: rgb(102, 102, 0);">,</span><span class=
=3D"styled-by-prettify" style=3D"font-family: Arial, Helvetica, sans-serif;=
color: rgb(0, 0, 0);"> </span><span class=3D"styled-by-prettify" style=3D"=
font-family: Arial, Helvetica, sans-serif; color: rgb(0, 0, 136);">typename=
</span><span class=3D"styled-by-prettify" style=3D"font-family: Arial, Helv=
etica, sans-serif; color: rgb(0, 0, 0);"> T</span><span class=3D"styled-by-=
prettify" style=3D"font-family: Arial, Helvetica, sans-serif; color: rgb(10=
2, 102, 0);">></span></div><div class=3D"subprettyprint"><span style=3D"=
color: #000;" class=3D"styled-by-prettify">=C2=A0 =C2=A0 </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> X2</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">;</span></div></code></div><div><br></d=
iv></div><div>Although, if it is made optional/not needed, one could use a =
comment instead for readability:</div><div class=3D"prettyprint" style=3D"b=
ackground-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); bord=
er-style: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"=
prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">=C2=A0 =C2=A0=C2=A0</span><span style=3D"color: #=
800;" class=3D"styled-by-prettify">// Not a template specialization but a t=
emplate with a single UTPT</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br>=C2=A0 =C2=A0=C2=A0</span><span style=3D"color: #008;" =
class=3D"styled-by-prettify">template</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify"><</span><span style=3D"color: #800;" class=3D"styled-b=
y-prettify">/*placeholder*/</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">></span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">struct</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> X0</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br><br>=C2=A0 =C2=A0=C2=A0</span><span style=3D"color: #800;" class=3D"styl=
ed-by-prettify">// A template with two consecutive UTPT</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0=C2=A0</spa=
n><span style=3D"color: #008;" class=3D"styled-by-prettify">template</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"=
color: #800;" class=3D"styled-by-prettify">/*placeholder*/</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #800;"=
class=3D"styled-by-prettify">/*placeholder*/</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"c=
olor: #008;" class=3D"styled-by-prettify">struct</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> X1</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 =C2=A0=C2=A0</span><span style=3D"co=
lor: #800;" class=3D"styled-by-prettify">// A template with constant, a UTP=
T, and a type</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br>=C2=A0 =C2=A0=C2=A0</span><span style=3D"color: #008;" class=3D"styl=
ed-by-prettify">template</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify"><</span><span style=3D"color: #008;" class=3D"styled-by-prettify">a=
uto</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> I</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: #800;" class=3D"styled-by-prettify">/*placeholder*/</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">typename</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">></span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"><br>=C2=A0 =C2=A0=C2=A0</span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> X2</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br></span></div></code></div><div><br>Currently, all contexts that=
I've stated are currently illegal, including the UTPT parameter pack, =
so would not impact current code in the wild.</div><div><br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/3d87d05f-a455-4c0c-8085-36542315e870%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/3d87d05f-a455-4c0c-8085-36542315e870=
%40isocpp.org</a>.<br />
------=_Part_4377_1648065044.1512918417398--
------=_Part_4376_1436409368.1512918417397--
.
Author: adrian.hawryluk@gmail.com
Date: Sun, 10 Dec 2017 07:41:11 -0800 (PST)
Raw View
------=_Part_4522_747762718.1512920471577
Content-Type: multipart/alternative;
boundary="----=_Part_4523_990978823.1512920471577"
------=_Part_4523_990978823.1512920471577
Content-Type: text/plain; charset="UTF-8"
>
> // Can't define a template with a placeholder TPT
> template <placeholder>
> struct X;
>
Note that I stated that you can't define a template with a UTPT. I have
reconsidered my stance on that as it might be useful to do so, so long as
the UTPT is not needed in that context.
One further note is that UTPTs are unnamed, the only way to access that
parameter is through specialization, at which point it becomes a real TPT,
which if named, can be referenced.
--
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/74e45204-982a-4205-9a52-847e41c443ac%40isocpp.org.
------=_Part_4523_990978823.1512920471577
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><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"><div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,18=
7,187);border-style:solid;border-width:1px;word-wrap:break-word"><code><spa=
n style=3D"color:#000">=C2=A0 =C2=A0=C2=A0</span><span style=3D"color:#800"=
>// Can't define a template with a placeholder TPT</span><span style=3D=
"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">template</=
span><span style=3D"color:#000"> </span><span style=3D"color:#080"><plac=
eholder></span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span=
style=3D"color:#008">struct</span><span style=3D"color:#000"> X</span><spa=
n style=3D"color:#660">;</span></code></div></div></blockquote><div>Note th=
at I stated that you can't define a template with a UTPT.=C2=A0 I have =
reconsidered my stance on that as it might be useful to do so, so long as t=
he UTPT is not needed in that context.</div><div><br></div><div>One further=
note is that UTPTs are unnamed, the only way to access that parameter is t=
hrough specialization, at which point it becomes a real TPT, which if named=
, can be referenced.</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/74e45204-982a-4205-9a52-847e41c443ac%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/74e45204-982a-4205-9a52-847e41c443ac=
%40isocpp.org</a>.<br />
------=_Part_4523_990978823.1512920471577--
------=_Part_4522_747762718.1512920471577--
.
Author: adrian.hawryluk@gmail.com
Date: Sun, 10 Dec 2017 07:49:36 -0800 (PST)
Raw View
------=_Part_4451_668769728.1512920976857
Content-Type: multipart/alternative;
boundary="----=_Part_4452_662774789.1512920976858"
------=_Part_4452_662774789.1512920976858
Content-Type: text/plain; charset="UTF-8"
>
> One further note is that UTPTs are unnamed, the only way to access that
> parameter is through specialization, at which point it becomes a real TPT,
> which if named, can be referenced.
>
I've reconsidered this. Instead of having a contextual keyword, we can use
any non-keyword or blank if the parameter is not referenced. If a single
non-keyword is used, then this becomes its name, and is how you can
reference a UTPT. This is important if that parameter is to be handed off
to another template.
--
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/e03d1943-88b7-4c2d-8b5d-a5f502f8504c%40isocpp.org.
------=_Part_4452_662774789.1512920976858
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><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"><div>One further note is that UTPTs are unnamed, the only way to access=
that parameter is through specialization, at which point it becomes a real=
TPT, which if named, can be referenced.<br></div></div></blockquote><div><=
br></div><div>I've reconsidered this.=C2=A0 Instead of having a context=
ual keyword, we can use any non-keyword or blank if the parameter is not re=
ferenced.=C2=A0 If a single non-keyword is used, then this becomes its name=
, and is how you can reference a UTPT.=C2=A0 This is important if that para=
meter is to be handed off to another template.</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/e03d1943-88b7-4c2d-8b5d-a5f502f8504c%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/e03d1943-88b7-4c2d-8b5d-a5f502f8504c=
%40isocpp.org</a>.<br />
------=_Part_4452_662774789.1512920976858--
------=_Part_4451_668769728.1512920976857--
.
Author: bastienpenava@gmail.com
Date: Sun, 10 Dec 2017 08:20:01 -0800 (PST)
Raw View
------=_Part_4612_1340044560.1512922801512
Content-Type: multipart/alternative;
boundary="----=_Part_4613_1084551993.1512922801512"
------=_Part_4613_1084551993.1512922801512
Content-Type: text/plain; charset="UTF-8"
On Sunday, December 10, 2017 at 4:49:36 PM UTC+1, adrian....@gmail.com
wrote:
>
> One further note is that UTPTs are unnamed, the only way to access that
>> parameter is through specialization, at which point it becomes a real TPT,
>> which if named, can be referenced.
>>
>
> I've reconsidered this. Instead of having a contextual keyword, we can
> use any non-keyword or blank if the parameter is not referenced. If a
> single non-keyword is used, then this becomes its name, and is how you can
> reference a UTPT. This is important if that parameter is to be handed off
> to another template.
>
Adding a new keyword to the language is a pain. This is not big enough to
grant such a pain.
As for the empty solution is not a great solution because the intent is
absolutely unclear, it's not easy to read and is really not C++-like.
Also you have decided without justification that such a placeholder can't
be used.
I don't see why as a general-purpose template parameter could be quite
useful.
It could be used to implement, for instance, named tuples for instance:
template<placeholder... X>
requires (sizeof...(X) % 2 == 0) && (even_are_types_and_odd_string_literals<
X...>())
struct named_tuple : even_into_tuple_t<X...>
{
template<auto& literal>
decltype(auto) get() noexcept { static_assert(literal_exists<literal>
()); ... }
};
named_tuple<std::string, "name", int, "age"> void get_student();
auto x = get_student().get<"name">();
And coupled with the meta_class proposal could allow to create real members
using the non-type argument as name.
--
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/18c43cee-34d2-4b6b-ad6f-abc1510c5911%40isocpp.org.
------=_Part_4613_1084551993.1512922801512
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Sunday, December 10, 2017 at 4:49:36 PM UTC+1, =
adrian....@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margi=
n: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><di=
v dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin:0;margin-le=
ft:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div=
>One further note is that UTPTs are unnamed, the only way to access that pa=
rameter is through specialization, at which point it becomes a real TPT, wh=
ich if named, can be referenced.<br></div></div></blockquote><div><br></div=
><div>I've reconsidered this.=C2=A0 Instead of having a contextual keyw=
ord, we can use any non-keyword or blank if the parameter is not referenced=
..=C2=A0 If a single non-keyword is used, then this becomes its name, and is=
how you can reference a UTPT.=C2=A0 This is important if that parameter is=
to be handed off to another template.</div></div></blockquote><div><br></d=
iv><font face=3D"arial, sans-serif" size=3D"2">Adding a new keyword to the =
language is a pain. This is not big enough to grant such a pain.</font><div=
><font face=3D"arial, sans-serif" size=3D"2">As for the empty solution is n=
ot a great solution because the intent is absolutely=C2=A0unclear, it's=
not easy to read and is really not C++-like.<br></font><div style=3D"font-=
family: arial, sans-serif; font-size: small;"><br></div><div style=3D"font-=
family: arial, sans-serif; font-size: small;">Also you have decided without=
justification that such a placeholder can't be used.</div><div style=
=3D"font-family: arial, sans-serif; font-size: small;">I don't see why =
as a general-purpose template parameter could be quite useful.</div><div st=
yle=3D"font-family: arial, sans-serif; font-size: small;">It could be used =
to implement, for instance, named tuples for instance:</div><div style=3D"f=
ont-family: arial, sans-serif; font-size: small;"><br></div><div class=3D"p=
rettyprint" style=3D"background-color: rgb(250, 250, 250); border-color: rg=
b(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: break-=
word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">template</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">placeholder</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">...</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> X</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">></span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"><br>requires </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">sizeof</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">...(</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">X</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
style=3D"color: #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: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">=3D=3D</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pretti=
fy">0</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: #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: #0=
00;" class=3D"styled-by-prettify">even_are_types_and_odd_string_literals</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify">X</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">...>())</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">struct</span><span style=3D"color:=
#000;" class=3D"styled-by-prettify"> named_tuple </span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">:</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> even_into_tuple_t</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">X</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">...></span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br>=C2=A0 =C2=A0 =C2=A0</span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">template</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify"><</span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">auto</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">&</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> literal</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 =C2=A0</span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">decltype</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">auto=
</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">get</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">()</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> noexcept </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"style=
d-by-prettify">static_assert</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify">literal_exists</span><span style=3D"color: #080;" class=3D"styled-=
by-prettify"><literal></span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">());</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">...</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><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"colo=
r: #000;" class=3D"styled-by-prettify"><br><br>named_tuple</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">std</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">string</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">"name"</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">int</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: #080;" class=3D"styled-by-prettify">"age"</span><span sty=
le=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=
08;" class=3D"styled-by-prettify">void</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> get_student</span><span style=3D"color: #660;"=
class=3D"styled-by-prettify">();</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">auto</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> x</span><font color=3D"#666600"><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> get_student</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">().</span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">get</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
<</span><span style=3D"color: #080;" class=3D"styled-by-prettify">"=
name"</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
>();</span></font></div></code></div><div><br></div></div><div>And coupl=
ed with the meta_class proposal could allow to create real members using th=
e non-type argument as name.</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/18c43cee-34d2-4b6b-ad6f-abc1510c5911%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/18c43cee-34d2-4b6b-ad6f-abc1510c5911=
%40isocpp.org</a>.<br />
------=_Part_4613_1084551993.1512922801512--
------=_Part_4612_1340044560.1512922801512--
.
Author: adrian.hawryluk@gmail.com
Date: Sun, 10 Dec 2017 09:21:07 -0800 (PST)
Raw View
------=_Part_4858_616159756.1512926467534
Content-Type: multipart/alternative;
boundary="----=_Part_4859_818701715.1512926467537"
------=_Part_4859_818701715.1512926467537
Content-Type: text/plain; charset="UTF-8"
Just a recap on how this would work:
A UTPT (undefined template parameter type) could be inserted into the
language without breakage of current code in the wild by using currently
illegal contexts, but is conceptually similar to how the current templating
system works, so should be easy to grasp to those who know it.
To define a UTPT, you specify a non-keyword identifier into the template
parameter list. This becomes the name of the UTPT. If the UTPT is not to be
referenced, then that parameter can be left blank. A UTPT parameter pack
can also be made by not stating the TPT (template parameter type) and just
specify ... (ellipsis) followed by an optional non-keyword identifier.
A UTPT can only be passed to another template or specialized on, as its
actual meaning is not understood at that context level. Once passed to
another template, or is specialized on to become a DTPT (defined template
parameter type) can it be actually be used.
As an example of how it could be used, I'll specify a tbinid class, which I
made, used to bind template parameters:
template <template <typename...> class OP, typename PARAMS, typename...Ts>
struct tbind_impl;
template <template <typename...> class OP, typename...Ss>
struct tbind_impl<OP, std::tuple<Ss...>>
{
template<typename...Us>
using ttype = OP<Ss...>;
};
template <template <typename...> class OP, typename T, typename...Ts,
typename...Ss>
struct tbind_impl<OP, std::tuple<Ss...>, T, Ts...>
{
template<typename...Us>
using ttype = typename tbind_impl<
OP
, std::tuple<Ss..., T>
, Ts...
>::template ttype<Us...>;
};
template <template <typename...> class OP, size_t I, typename...Ts, typename
....Ss>
struct tbind_impl<OP, std::tuple<Ss...>, std::integral_constant<size_t, I>,
Ts...>
{
template<typename...Us>
using ttype = typename tbind_impl<
OP
, typename std::tuple<
Ss...
, typename std::tuple_element<
I
, std::tuple<Us...>
>::type
>
, Ts...
>::template ttype<Us...>;
using t0 = std::integral_constant<size_t, 0>;
using t1 = std::integral_constant<size_t, 1>;
using t2 = std::integral_constant<size_t, 2>;
// ... other placeholders
template <template <typename...> class OP, typename...Ts>
struct tbind : tbind_impl<OP, std::tuple<>, Ts...>
{};
That is the original, and will bind only types to a template that only has
types as its parameters. Now if UTPTs were allowed, we could do something
like this:
template <...>
struct UTPT_list {};
template <size_t I, size_t N, ...Ts>
UTPT_element_impl;
template <size_t I, size_t N, T, ...Ts>
UTPT_element_impl<I, N, Ts...>
: UTPT_element_impl<I+1, N, Ts...>
{};
template <size_t N, auto V, ...Ts>
UTPT_element_impl
{
static constexpr auto item = V;
};
template <size_t N, typename T, ...Ts>
UTPT_element_impl
{
using item = T;
};
template <size_t N, template<...> TT, ...Ts>
UTPT_element_impl
{
template<...Us>
using item = T<Us...>;
};
template <size_t N, ...Ts>
UTPT_element : UTPT_element_impl<0, N, Ts...> {};
template <template <...> class OP, typename PARAMS, ...Ts>
struct tbind_impl;
template <template <...> class OP, ...Ss>
struct tbind_impl<OP, UTPT_list<Ss...>>
{
template<...Us>
using ttype = OP<Ss...>;
};
template <template <...> class OP, T, ...Ts, ...Ss>
struct tbind_impl<OP, UTPT_list<Ss...>, T, Ts...>
{
template<...Us>
using ttype = typename tbind_impl<
OP
, UTPT_list<Ss..., T>
, Ts...
>::template ttype<Us...>;
};
template <template <...> class OP, size_t I, ...Ts, ...Ss>
struct tbind_impl<OP, UTPT_list<Ss...>, std::integral_constant<size_t, I>,
Ts...>
{
template<...Us>
using ttype = typename tbind_impl<
OP
, typename UTPT_list<
Ss...
, UTPT_element<I, Us...>::item
>
, Ts...
>::template ttype<Us...>;
using t0 = std::integral_constant<size_t, 0>;
using t1 = std::integral_constant<size_t, 1>;
using t2 = std::integral_constant<size_t, 2>;
// ... other placeholders
template <template <...> class OP, ...Ts>
struct tbind : tbind_impl<OP, UTPT_list<>, Ts...>
{};
Which would allow binding of any template parameter no matter if a template
parameter list consists of mixed TPTs.
Current usage would be:
// limited to templates that consist of only types
bool result = tbind<is_convertible, t1, long>::ttype<int>::value
// result == true
Where as it could be extended to something like this:
// these would result in a double type
tbind<UTPT_element, 2, t0, t1, t2>::ttype<int, float, double>>::item x = 1.3
;
tbind<UTPT_element, t0, t1, t2, double>::ttype<2, int, float>>::item x = 1.3
;
I hope this makes my intentions clear.
--
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/774d4f68-8354-472e-92ea-ceb5d484089b%40isocpp.org.
------=_Part_4859_818701715.1512926467537
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Just a recap on how this would work:<br><br>A UTPT (undefi=
ned template parameter type) could be inserted into the language without br=
eakage of current code in the wild by using currently illegal contexts, but=
is conceptually similar to how the current templating system works, so sho=
uld be easy to grasp to those who know it. <br><br>To define a UTPT, you s=
pecify a non-keyword identifier into the template parameter list. This bec=
omes the name of the UTPT. If the UTPT is not to be referenced, then that =
parameter can be left blank. A UTPT parameter pack can also be made by not=
stating the TPT (template parameter type) and just specify ... (ellipsis) =
followed by an optional non-keyword identifier.<br><br>A UTPT can only be p=
assed to another template or specialized on, as its actual meaning is not u=
nderstood at that context level. Once passed to another template, or is sp=
ecialized on to become a DTPT (defined template parameter type) can it be a=
ctually be used. <br><br>As an example of how it could be used, I'll sp=
ecify a tbinid class, which I made, used to bind template parameters:<br><d=
iv class=3D"prettyprint" style=3D"border-width: 1px; border-style: solid; b=
order-color: rgb(187, 187, 187); background-color: rgb(250, 250, 250); word=
-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subprettyprin=
t"><span style=3D"color: #008;" class=3D"styled-by-prettify">template</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D=
"color: #008;" class=3D"styled-by-prettify">template</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify"><</span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">typename</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">...></span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">class</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> OP</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #008;" class=3D"styled-by-prettify">typename</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> PARAMS</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=
: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">...</span><span style=3D"color: #606;" =
class=3D"styled-by-prettify">Ts</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">></span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">struct</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> tbind_impl</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">templ=
ate</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: #008;" class=3D"styled-by-prettify">template</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color: =
#008;" class=3D"styled-by-prettify">typename</span><span style=3D"color: #6=
60;" 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: #000;" class=3D"s=
tyled-by-prettify"> OP</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">typena=
me</span><span style=3D"color: #660;" class=3D"styled-by-prettify">...</spa=
n><span style=3D"color: #606;" class=3D"styled-by-prettify">Ss</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"co=
lor: #008;" class=3D"styled-by-prettify">struct</span><span style=3D"color:=
#000;" class=3D"styled-by-prettify"> tbind_impl</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify">OP</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> std</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
>tuple</span><span style=3D"color: #660;" class=3D"styled-by-prettify"><=
</span><span style=3D"color: #606;" class=3D"styled-by-prettify">Ss</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 </span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">template</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">...</span><span style=3D"color: #6=
06;" class=3D"styled-by-prettify">Us</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">></span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">using</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> ttype </span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> OP</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify"><</span><span style=3D"color: #606;" class=3D"styled-by-prettify"=
>Ss</span><span style=3D"color: #660;" class=3D"styled-by-prettify">...>=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">};</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">template</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><span style=3D"color: #00=
8;" 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"><</span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">typename</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">...></span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">class</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
OP</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: #008;" class=3D"styled-by-prettify">typename</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"colo=
r: #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">typename</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">...</span><span style=3D"color: #606;" class=3D"styled-b=
y-prettify">Ts</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: #008;" class=3D"styled-by-prettify">typename</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">...</span><span =
style=3D"color: #606;" class=3D"styled-by-prettify">Ss</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">></span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> tbind_impl</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify"><</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">OP</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> std</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">tuple</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><=
span style=3D"color: #606;" class=3D"styled-by-prettify">Ss</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">...>,</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"colo=
r: #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">Ts</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-pretti=
fy">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">template</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
"><</span><span style=3D"color: #008;" class=3D"styled-by-prettify">type=
name</span><span style=3D"color: #660;" class=3D"styled-by-prettify">...</s=
pan><span style=3D"color: #606;" class=3D"styled-by-prettify">Us</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">></span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">using</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> ttype </span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">typename</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"> tbind_impl</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify"><</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 OP<br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">tuple</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><s=
pan style=3D"color: #606;" class=3D"styled-by-prettify">Ss</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">...,</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">></span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span st=
yle=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: #606=
;" class=3D"styled-by-prettify">Ts</span><span style=3D"color: #660;" class=
=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: #008;" class=3D=
"styled-by-prettify">template</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> ttype</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify"><</span><span style=3D"color: #606;" class=3D"styled-by-p=
rettify">Us</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">};</spa=
n><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><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">template</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;"=
class=3D"styled-by-prettify"><</span><span style=3D"color: #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"> </span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">class</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> OP</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> size_t I=
</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">typename</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">...</span><span style=3D"col=
or: #606;" class=3D"styled-by-prettify">Ts</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"style=
d-by-prettify">typename</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">...</span><span style=3D"color: #606;" class=3D"styled-by-pret=
tify">Ss</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&g=
t;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> tbind_impl</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify">OP</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">tuple</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify"><</span><span style=3D"color: #606;" class=3D"styled-by-=
prettify">Ss</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">::</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify">integral_const=
ant</span><span style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify">size_t</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> I</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">>,</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" cl=
ass=3D"styled-by-prettify">Ts</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">...></span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">template</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify"><</span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>typename</span><span style=3D"color: #660;" class=3D"styled-by-prettify">.=
...</span><span style=3D"color: #606;" class=3D"styled-by-prettify">Us</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 </sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">using</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> ttype </span><span=
style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> tbind_impl</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 =C2=A0 =C2=A0 OP<br=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </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: #008;" class=3D"styled-by-prettify"=
>typename</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify">tuple</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #606;" class=3D"st=
yled-by-prettify">Ss</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">...</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"colo=
r: #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">typename</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> std</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">tuple_element</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify"><</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 I<br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =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"> std</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">tuple</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify"><</span><span style=3D"color: #606;" class=3D"styled-=
by-prettify">Us</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 =C2=A0 =C2=A0 =C2=A0 =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">type<br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>></span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">=
Ts</span><span style=3D"color: #660;" class=3D"styled-by-prettify">...</spa=
n><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: #008;" class=3D"styled-by-prettify">template</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> ttype</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span=
style=3D"color: #606;" class=3D"styled-by-prettify">Us</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">...>;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">using</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> t0 </span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">integral_constant</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify"><</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify">size_t</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #066;" class=3D"styled-by-prettify">0</s=
pan><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: #008;" class=3D"styled-by-prettify">using</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> t1 </span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify">integral_constant</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify"><</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify">size_t</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #066;" class=3D"styled-by-prettify">1=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">>;</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">using</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> t2 </span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> std</span><span style=3D"color: #660;"=
class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">integral_constant</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify"><</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify">size_t</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: #066;" class=3D"styled-by-prettif=
y">2</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: #800;" class=3D"styled-by-prettify">// ... other plac=
eholders</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: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><spa=
n 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"><</span><span style=3D"color:=
#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"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">class</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> OP</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">typena=
me</span><span style=3D"color: #660;" class=3D"styled-by-prettify">...</spa=
n><span style=3D"color: #606;" class=3D"styled-by-prettify">Ts</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"co=
lor: #008;" class=3D"styled-by-prettify">struct</span><span style=3D"color:=
#000;" class=3D"styled-by-prettify"> tbind </span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">:</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> tbind_impl</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify"><</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify">OP</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> std</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify">tuple</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">Ts</span><span style=3D"co=
lor: #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><br>That is th=
e original, and will bind only types to a template that only has types as i=
ts parameters. Now if UTPTs were allowed, we could do something like this:<=
br><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250)=
; border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px;=
word-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subprett=
yprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">template<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify"><...></span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> UTPT_list </span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">{};</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br><br></span><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"><</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">size_t I</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> size_t N</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">...<=
/span><span style=3D"color: #606;" class=3D"styled-by-prettify">Ts</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">></span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br>UTPT_element_impl</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">template</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><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">size_t I</span><span style=3D"color: #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">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> T</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: #660;" class=3D"styled-by-prettify">...</span><=
span style=3D"color: #606;" class=3D"styled-by-prettify">Ts</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">></span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br>UTPT_element_impl</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">I</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"> N</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: #606;" class=3D"styled-by-pret=
tify">Ts</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 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">:</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> UTPT_elemen=
t_impl</span><span style=3D"color: #660;" class=3D"styled-by-prettify"><=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify">I</span><s=
pan 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"styled-by-prettify">,</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> N</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: #606;" class=3D"styled-by-prettif=
y">Ts</span><span style=3D"color: #660;" class=3D"styled-by-prettify">...&g=
t;</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><spa=
n 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 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: #=
000;" class=3D"styled-by-prettify">size_t N</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: #008;" class=3D"style=
d-by-prettify">auto</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> V</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 s=
tyle=3D"color: #606;" class=3D"styled-by-prettify">Ts</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">></span><span style=3D"color:=
#000;" class=3D"styled-by-prettify"><br>UTPT_element_impl<br></span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">static</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">constexpr</span><span style=3D"color:=
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">auto</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> item </span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> V</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">;</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><br></span><sp=
an 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"><</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">,</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">typename</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> T</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: #660;" class=3D"styled-by-prettify">...</span>=
<span style=3D"color: #606;" class=3D"styled-by-prettify">Ts</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">></span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br>UTPT_element_impl<br></span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span>=
<span style=3D"color: #008;" class=3D"styled-by-prettify">using</span><span=
style=3D"color: #000;" class=3D"styled-by-prettify"> item </span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> T</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></span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">};</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br><br></span><span style=3D"color: #008;" class=3D"styled-by-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: #000;" class=3D"styled-by-prettify">size_t N=
</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">template</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify"><...></span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> TT</span><span style=3D"co=
lor: #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: #606;" class=3D"sty=
led-by-prettify">Ts</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">></span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br>UTPT_element_impl<br></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>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">template</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify"><...</span><span style=3D"color: #606;" class=3D"styled-b=
y-prettify">Us</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">></span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">using</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> item </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D=
</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 s=
tyle=3D"color: #606;" class=3D"styled-by-prettify">Us</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">...>;</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">};</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br><br></span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">template</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-p=
rettify">size_t N</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: #660;" class=3D"styled-by-prettify">...</span><=
span style=3D"color: #606;" class=3D"styled-by-prettify">Ts</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">></span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br>UTPT_element </span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">:</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> UTPT_element_impl</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"=
color: #066;" class=3D"styled-by-prettify">0</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> N</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">T=
s</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: #660;" class=3D"styled-by-prettify">{};</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">template</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: #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"><...></span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">class</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> OP</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #008;" class=3D"styled-by-prettify">typename</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> PARAMS</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=
: #660;" class=3D"styled-by-prettify">...</span><span style=3D"color: #606;=
" class=3D"styled-by-prettify">Ts</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">></span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">struct</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> tbind_impl</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: #008;" class=3D"styled-by-prettify">te=
mplate</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">template</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify"><...></span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">class</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> OP</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">...</span><span style=3D"color: #606;" class=3D"styled-by-prettify=
">Ss</span><span style=3D"color: #660;" class=3D"styled-by-prettify">></=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span=
style=3D"color: #000;" class=3D"styled-by-prettify"> tbind_impl</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">OP</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> UTPT_list</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify"><</span><span style=3D"color: #606;" clas=
s=3D"styled-by-prettify">Ss</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">...>></span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">template</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify"><...</span><span style=3D"color: #606;" class=3D"styled-by-pret=
tify">Us</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&g=
t;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=
=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>using</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> tty=
pe </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> OP</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span styl=
e=3D"color: #606;" class=3D"styled-by-prettify">Ss</span><span style=3D"col=
or: #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><br></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;" class=3D"style=
d-by-prettify"><</span><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: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">class</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> OP</span><span=
style=3D"color: #660;" class=3D"styled-by-prettify">,</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;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">...</span><span style=3D"color: #606;" class=3D"styled-by=
-prettify">Ts</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">...</span><span=
style=3D"color: #606;" class=3D"styled-by-prettify">Ss</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">></span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">struct</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> tbind_impl</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify"><</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">OP</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> UTPT_list</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify"><</span><span style=3D"color: #606;" class=3D"styled-by-prettif=
y">Ss</span><span style=3D"color: #660;" class=3D"styled-by-prettify">...&g=
t;,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> T</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">Ts</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">...></span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br></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>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">template</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify"><...</span><span style=3D"color: #606;" class=3D=
"styled-by-prettify">Us</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">></span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">using</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> ttype </span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">typename<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> tbind_impl=
</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 =C2=A0 =C2=A0 OP<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> UTPT_list</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color: #6=
06;" class=3D"styled-by-prettify">Ss</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">...,</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-pret=
tify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-=
prettify">Ts</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">...</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">>::</span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
template</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> t=
type</span><span style=3D"color: #660;" class=3D"styled-by-prettify"><</=
span><span style=3D"color: #606;" class=3D"styled-by-prettify">Us</span><sp=
an 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"colo=
r: #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: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify"><</span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">template</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: #008;" class=3D"styled-by-prettify"=
>class</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> OP<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> size_t I</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=
: #660;" class=3D"styled-by-prettify">...</span><span style=3D"color: #606;=
" class=3D"styled-by-prettify">Ts</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: #660;" class=3D"styled-by-pret=
tify">...</span><span style=3D"color: #606;" class=3D"styled-by-prettify">S=
s</span><span style=3D"color: #660;" class=3D"styled-by-prettify">></spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> tbind_impl</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">OP</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"> UTPT_list</span><span style=3D"color: #660;"=
class=3D"styled-by-prettify"><</span><span style=3D"color: #606;" class=
=3D"styled-by-prettify">Ss</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">...>,</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> std</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
integral_constant</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify"><</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
>size_t</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> I</span><sp=
an 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">Ts</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">...></span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">template</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify"><...</span><span style=3D"color: #606;" class=3D=
"styled-by-prettify">Us</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">></span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">using</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> ttype </span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">typename<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> tbind_impl=
</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 =C2=A0 =C2=A0 OP<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </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: #008;=
" class=3D"styled-by-prettify">typename</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> UTPT_list</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 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 </span><span style=3D"color: #606;" class=3D"styled-by-prettify">Ss</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">...</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> UTPT_element</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify"><</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y">I</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #606;" class=3D"styled-by-prettify">Us</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">...>::</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">item<br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>></span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">=
Ts</span><span style=3D"color: #660;" class=3D"styled-by-prettify">...</spa=
n><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: #008;" class=3D"styled-by-prettify">template</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> ttype</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span=
style=3D"color: #606;" class=3D"styled-by-prettify">Us</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">...>;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">using</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> t0 </span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">integral_constant</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify"><</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify">size_t</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #066;" class=3D"styled-by-prettify">0</s=
pan><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: #008;" class=3D"styled-by-prettify">using</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> t1 </span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify">integral_constant</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify"><</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify">size_t</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #066;" class=3D"styled-by-prettify">1=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">>;</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">using</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> t2 </span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> std</span><span style=3D"color: #660;"=
class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">integral_constant</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify"><</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify">size_t</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: #066;" class=3D"styled-by-prettif=
y">2</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: #800;" class=3D"styled-by-prettify">// ... other plac=
eholders</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: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><spa=
n 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"><...></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: #000;"=
class=3D"styled-by-prettify"> OP</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: #660;" class=3D"styled-by-pret=
tify">...</span><span style=3D"color: #606;" class=3D"styled-by-prettify">T=
s</span><span style=3D"color: #660;" class=3D"styled-by-prettify">></spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> tbind </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">:</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> tbind_impl</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">OP</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> UTPT_list</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify"><>,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-pret=
tify">Ts</span><span style=3D"color: #660;" class=3D"styled-by-prettify">..=
..></span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">{};</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div><=
/code></div><div><br></div>Which would allow binding of any template parame=
ter no matter if a template parameter list consists of mixed TPTs.<div><br>=
</div><div>Current usage would be:</div><div class=3D"prettyprint" style=3D=
"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); bo=
rder-style: solid; border-width: 1px; word-wrap: break-word;"><code class=
=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #800;"=
class=3D"styled-by-prettify">// limited to templates that consist of only =
types</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"color: #000;" class=3D"styled-by-prettify"> result </span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> tbind</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">is_convertible</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> t1</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"style=
d-by-prettify">long</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">>::</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">ttype</span><span style=3D"color: #080;" 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">value<b=
r></span><span style=3D"color: #800;" class=3D"styled-by-prettify">// resul=
t =3D=3D true</span></div></code></div><div><br></div><div>Where as it coul=
d be extended to something like this:<br><div class=3D"prettyprint" style=
=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187);=
border-style: solid; border-width: 1px; word-wrap: break-word;"><code clas=
s=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #800;=
" class=3D"styled-by-prettify">// these would result in a double type</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>tbind</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify">UTPT_element</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">2</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> t0</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> t1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> t2</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">>::</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify">ttype</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">int</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styl=
ed-by-prettify">float</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">double<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">>>::<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify">item x </sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #066;" class=3D"styled-by-prettify">1.3</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br>tbind</span><span style=3D"color: #660;"=
class=3D"styled-by-prettify"><</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">UTPT_element</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> t0</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> t1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> t2</span><span=
style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">double</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">>::</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">ttype</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify"><</span><span style=3D"color: #066;" class=3D"st=
yled-by-prettify">2</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: #008;" class=3D"styled-by-prettify">int</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">float</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">>>::</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify">item x </span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #066;" class=3D"sty=
led-by-prettify">1.3</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br></span></div></code></div><br>I hope this makes my intentions clear.</=
div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/774d4f68-8354-472e-92ea-ceb5d484089b%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/774d4f68-8354-472e-92ea-ceb5d484089b=
%40isocpp.org</a>.<br />
------=_Part_4859_818701715.1512926467537--
------=_Part_4858_616159756.1512926467534--
.
Author: adrian.hawryluk@gmail.com
Date: Sun, 10 Dec 2017 09:25:46 -0800 (PST)
Raw View
------=_Part_4802_405807168.1512926746764
Content-Type: multipart/alternative;
boundary="----=_Part_4803_796512513.1512926746764"
------=_Part_4803_796512513.1512926746764
Content-Type: text/plain; charset="UTF-8"
On Sunday, December 10, 2017 at 11:20:01 AM UTC-5, bastie...@gmail.com
wrote:
>
>
>
> On Sunday, December 10, 2017 at 4:49:36 PM UTC+1, adrian....@gmail.com
> wrote:
>>
>> One further note is that UTPTs are unnamed, the only way to access that
>>> parameter is through specialization, at which point it becomes a real TPT,
>>> which if named, can be referenced.
>>>
>>
>> I've reconsidered this. Instead of having a contextual keyword, we can
>> use any non-keyword or blank if the parameter is not referenced. If a
>> single non-keyword is used, then this becomes its name, and is how you can
>> reference a UTPT. This is important if that parameter is to be handed off
>> to another template.
>>
>
> Adding a new keyword to the language is a pain. This is not big enough to
> grant such a pain.
> As for the empty solution is not a great solution because the intent is
> absolutely unclear, it's not easy to read and is really not C++-like.
>
Please see my example and tell me if that is unclear.
> Also you have decided without justification that such a placeholder
> can't be used.
>
I don't see why as a general-purpose template parameter could be quite
> useful.
> It could be used to implement, for instance, named tuples for instance:
>
> template<placeholder... X>
> requires (sizeof...(X) % 2 == 0) && (
> even_are_types_and_odd_string_literals<X...>())
> struct named_tuple : even_into_tuple_t<X...>
> {
> template<auto& literal>
> decltype(auto) get() noexcept { static_assert(literal_exists<literal>
> ()); ... }
> };
>
> named_tuple<std::string, "name", int, "age"> void get_student();
> auto x = get_student().get<"name">();
>
And coupled with the meta_class proposal could allow to create real members
> using the non-type argument as name.
>
You're right, that wasn't my intention. Of course you could use the UTPT
identifier where the TPT is not needed.
--
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/a07fc680-5b8a-4958-8c4e-343ed83500d6%40isocpp.org.
------=_Part_4803_796512513.1512926746764
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Sunday, December 10, 2017 at 11:20:01 AM UTC-5,=
bastie...@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margi=
n: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><di=
v dir=3D"ltr"><br><br>On Sunday, December 10, 2017 at 4:49:36 PM UTC+1, <a>=
adrian....@gmail.com</a> wrote:<blockquote class=3D"gmail_quote" style=3D"m=
argin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div=
dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin:0;margin-lef=
t:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>=
One further note is that UTPTs are unnamed, the only way to access that par=
ameter is through specialization, at which point it becomes a real TPT, whi=
ch if named, can be referenced.<br></div></div></blockquote><div><br></div>=
<div>I've reconsidered this.=C2=A0 Instead of having a contextual keywo=
rd, we can use any non-keyword or blank if the parameter is not referenced.=
=C2=A0 If a single non-keyword is used, then this becomes its name, and is =
how you can reference a UTPT.=C2=A0 This is important if that parameter is =
to be handed off to another template.</div></div></blockquote><div><br></di=
v><font face=3D"arial, sans-serif" size=3D"2">Adding a new keyword to the l=
anguage is a pain. This is not big enough to grant such a pain.</font><div>=
<font face=3D"arial, sans-serif" size=3D"2">As for the empty solution is no=
t a great solution because the intent is absolutely=C2=A0unclear, it's =
not easy to read and is really not C++-like.<br></font></div></div></blockq=
uote><div><br></div><div>Please see my example and tell me if that is uncle=
ar.</div><div>=C2=A0</div><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"><div><font face=3D"arial, sans-serif" size=3D"2"></font><div s=
tyle=3D"font-family:arial,sans-serif;font-size:small"><span style=3D"font-f=
amily: Arial, Helvetica, sans-serif; font-size: 13px;">=C2=A0</span>Also yo=
u have decided without justification that such a placeholder can't be u=
sed.</div></div></div></blockquote><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"><div><div style=3D"font-family:arial,sans-serif;font=
-size:small">I don't see why as a general-purpose template parameter co=
uld be quite useful.</div><div style=3D"font-family:arial,sans-serif;font-s=
ize:small">It could be used to implement, for instance, named tuples for in=
stance:</div><div style=3D"font-family:arial,sans-serif;font-size:small"><b=
r></div><div style=3D"background-color:rgb(250,250,250);border-color:rgb(18=
7,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><code>=
<div><span style=3D"color:#008">template</span><span style=3D"color:#660">&=
lt;</span><span style=3D"color:#000">placeholder</span><span style=3D"color=
:#660">...</span><span style=3D"color:#000"> X</span><span style=3D"color:#=
660">></span><span style=3D"color:#000"><br>requires </span><span style=
=3D"color:#660">(</span><span style=3D"color:#008">sizeof</span><span style=
=3D"color:#660">...(</span><span style=3D"color:#000">X</span><span style=
=3D"color:#660">)</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#660">%</span><span style=3D"color:#000"> </span><span style=3D"color:=
#066">2</span><span style=3D"color:#000"> </span><span style=3D"color:#660"=
>=3D=3D</span><span style=3D"color:#000"> </span><span style=3D"color:#066"=
>0</span><span style=3D"color:#660">)</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">even_=
are_types_and_odd_<wbr>string_literals</span><span style=3D"color:#660"><=
;</span><span style=3D"color:#000">X</span><span style=3D"color:#660">...&g=
t;())</span><span style=3D"color:#000"><br></span><span style=3D"color:#008=
">struct</span><span style=3D"color:#000"> named_tuple </span><span style=
=3D"color:#660">:</span><span style=3D"color:#000"> even_into_tuple_t</span=
><span style=3D"color:#660"><</span><span style=3D"color:#000">X</span><=
span style=3D"color:#660">...></span><span style=3D"color:#000"><br></sp=
an><span style=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0=
=C2=A0 =C2=A0</span><span style=3D"color:#008">template</span><span style=
=3D"color:#660"><</span><span style=3D"color:#008">auto</span><span styl=
e=3D"color:#660">&</span><span style=3D"color:#000"> literal</span><spa=
n style=3D"color:#660">></span><span style=3D"color:#000"><br>=C2=A0 =C2=
=A0 =C2=A0</span><span style=3D"color:#008">decltype</span><span style=3D"c=
olor:#660">(</span><span style=3D"color:#008">auto</span><span style=3D"col=
or:#660">)</span><span style=3D"color:#000"> </span><span style=3D"color:#0=
08">get</span><span style=3D"color:#660">()</span><span style=3D"color:#000=
"> noexcept </span><span style=3D"color:#660">{</span><span style=3D"color:=
#000"> </span><span style=3D"color:#008">static_assert</span><span style=3D=
"color:#660">(</span><span style=3D"color:#000">literal_exists</span><span =
style=3D"color:#080"><<wbr>literal></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:#660">}</sp=
an><span style=3D"color:#000"><br></span><span style=3D"color:#660">};</spa=
n><span style=3D"color:#000"><br><br>named_tuple</span><span style=3D"color=
:#660"><</span><span style=3D"color:#000">std</span><span style=3D"color=
:#660">::</span><span style=3D"color:#008">string</span><span style=3D"colo=
r:#660">,</span><span style=3D"color:#000"> </span><span style=3D"color:#08=
0">"name"</span><span style=3D"color:#660">,</span><span style=3D=
"color:#000"> </span><span style=3D"color:#008">int</span><span style=3D"co=
lor:#660">,</span><span style=3D"color:#000"> </span><span style=3D"color:#=
080">"age"</span><span style=3D"color:#660">></span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#008">void</span><span style=
=3D"color:#000"> get_student</span><span style=3D"color:#660">();</span><sp=
an style=3D"color:#000"><br></span><span style=3D"color:#008">auto</span><s=
pan style=3D"color:#000"> x</span><font color=3D"#666600"><span style=3D"co=
lor:#000"> </span><span style=3D"color:#660">=3D</span><span style=3D"color=
:#000"> get_student</span><span style=3D"color:#660">().</span><span style=
=3D"color:#008">get</span><span style=3D"color:#660"><</span><span style=
=3D"color:#080">"name"</span><span style=3D"color:#660">>();</=
span></font></div></code></div></div></div></blockquote><blockquote class=
=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #cc=
c solid;padding-left: 1ex;"><div dir=3D"ltr"><div><div></div></div><div>And=
coupled with the meta_class proposal could allow to create real members us=
ing the non-type argument as name.</div></div></blockquote><div><br></div><=
div>You're right, that wasn't my intention.=C2=A0 Of course you cou=
ld use the UTPT identifier where the TPT is not needed.<br></div><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" 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/a07fc680-5b8a-4958-8c4e-343ed83500d6%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/a07fc680-5b8a-4958-8c4e-343ed83500d6=
%40isocpp.org</a>.<br />
------=_Part_4803_796512513.1512926746764--
------=_Part_4802_405807168.1512926746764--
.
Author: adrian.hawryluk@gmail.com
Date: Sun, 10 Dec 2017 09:29:33 -0800 (PST)
Raw View
------=_Part_4761_1414492746.1512926973923
Content-Type: multipart/alternative;
boundary="----=_Part_4762_1621955709.1512926973923"
------=_Part_4762_1621955709.1512926973923
Content-Type: text/plain; charset="UTF-8"
This was an error:
template <size_t N, template<...> TT, ...Ts>
UTPT_element_impl
{
template<...Us>
using item = T<Us...>;
};
Should be:
template <size_t N, template<...> class TT, ...Ts>
UTPT_element_impl
{
template<...Us>
using item = TT<Us...>;
};
--
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/3173e6c9-d4cd-4cd7-aa64-5cbaf8c97266%40isocpp.org.
------=_Part_4762_1621955709.1512926973923
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">This was an error:<br><div class=3D"prettyprint" style=3D"=
background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); bor=
der-style: solid; border-width: 1px; word-wrap: break-word;"><code class=3D=
"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">template</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styl=
ed-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-pr=
ettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">template</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify"><...><=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> TT</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><span style=3D"color: #606=
;" class=3D"styled-by-prettify">Ts</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">></span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br>UTPT_element_impl<br></span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">template</span><span style=3D"color: #660;"=
class=3D"styled-by-prettify"><...</span><span style=3D"color: #606;" cl=
ass=3D"styled-by-prettify">Us</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">></span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">using</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> item </span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> T</span><span style=3D"color: #660;" class=3D"styled-by-prettify"><=
;</span><span style=3D"color: #606;" class=3D"styled-by-prettify">Us</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">...>;</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">};</span></div></code></d=
iv><br><div>Should be:</div><div class=3D"prettyprint" style=3D"background-=
color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: =
solid; border-width: 1px; word-wrap: break-word;"><code class=3D"prettyprin=
t"><div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styl=
ed-by-prettify">template</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify"><</span><span style=3D"color: #000;" class=3D"styled-by-prettify">s=
ize_t N</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: #008;" class=3D"styled-by-prettify">template</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">class</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> TT</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: #606;" class=3D"styled-by-pr=
ettify">Ts</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
></span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>UT=
PT_element_impl<br></span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">template</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify"><...</span><span style=3D"color: #606;" class=3D"styled-by-prettif=
y">Us</span><span style=3D"color: #660;" class=3D"styled-by-prettify">><=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =
=C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">usi=
ng</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> item </=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> TT</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"=
color: #606;" class=3D"styled-by-prettify">Us</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">...>;</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">};</span></div></code></div><div><span style=3D"=
font-family: monospace; background-color: rgb(250, 250, 250); color: rgb(10=
2, 102, 0);"><br></span><br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/3173e6c9-d4cd-4cd7-aa64-5cbaf8c97266%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/3173e6c9-d4cd-4cd7-aa64-5cbaf8c97266=
%40isocpp.org</a>.<br />
------=_Part_4762_1621955709.1512926973923--
------=_Part_4761_1414492746.1512926973923--
.
Author: adrian.hawryluk@gmail.com
Date: Sun, 10 Dec 2017 09:36:33 -0800 (PST)
Raw View
------=_Part_4877_2003821666.1512927393390
Content-Type: multipart/alternative;
boundary="----=_Part_4878_1808637783.1512927393390"
------=_Part_4878_1808637783.1512927393390
Content-Type: text/plain; charset="UTF-8"
Another error:
Was:
> Current usage would be:
> // limited to templates that consist of only types
> bool result = tbind<is_convertible, t1, long>::ttype<int>::value
> // result == true
>
>
Should be:
> Current usage would be:
> // limited to templates that consist of only types
> bool result = tbind<is_convertible, t0, long>::ttype<int>::value
> // result == true
>
>
--
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/2f9ff116-a72a-4375-ab77-7f3e4a09d63f%40isocpp.org.
------=_Part_4878_1808637783.1512927393390
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Another error:<div><br></div><div>Was:</div><div><blockquo=
te class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; border-left: 1=
px solid rgb(204, 204, 204); padding-left: 1ex;">Current usage would be:<br=
><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); =
border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; w=
ord-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subprettyp=
rint"><span style=3D"color: #800;" class=3D"styled-by-prettify">// limited =
to templates that consist of only types</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"color: #000;" class=3D"st=
yled-by-prettify"> result </span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> tbind</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify"><</span><span style=3D"color: #000;" class=3D"styled-by-prettify">i=
s_convertible</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> t1</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: #008;" class=3D"styled-by-prettify">long</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">>::</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify">ttype</span><span style=3D"color: #080;" =
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">value<br></span><span style=3D"color: #800;" class=
=3D"styled-by-prettify">// result =3D=3D true</span></div></code></div><br>=
</blockquote><div><br></div><div>Should be:</div><div><blockquote style=3D"=
margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); paddi=
ng-left: 1ex;" class=3D"gmail_quote">Current usage would be:<br><div class=
=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); border-colo=
r: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: b=
reak-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span=
style=3D"color: #800;" class=3D"styled-by-prettify">// limited to template=
s that consist of only types</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">bool</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> result </span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> tb=
ind</span><span style=3D"color: #660;" class=3D"styled-by-prettify"><</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify">is_convertibl=
e</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> t0</span><span st=
yle=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: #008=
;" class=3D"styled-by-prettify">long</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">>::</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">ttype</span><span style=3D"color: #080;" class=3D"s=
tyled-by-prettify"><int></span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">value<br></span><span style=3D"color: #800;" class=3D"styled-by=
-prettify">// result =3D=3D true</span></div></code></div><code><span style=
=3D"color: rgb(136, 0, 0);"><br></span></code></blockquote></div><div>=C2=
=A0</div></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/2f9ff116-a72a-4375-ab77-7f3e4a09d63f%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/2f9ff116-a72a-4375-ab77-7f3e4a09d63f=
%40isocpp.org</a>.<br />
------=_Part_4878_1808637783.1512927393390--
------=_Part_4877_2003821666.1512927393390--
.
Author: adrian.hawryluk@gmail.com
Date: Sun, 10 Dec 2017 11:21:15 -0800 (PST)
Raw View
------=_Part_4967_168499488.1512933675576
Content-Type: multipart/alternative;
boundary="----=_Part_4968_200830976.1512933675576"
------=_Part_4968_200830976.1512933675576
Content-Type: text/plain; charset="UTF-8"
Amending this line:
> A UTPT can only be passed to another template or specialized on, as its
> actual meaning is not understood at that context level. Once passed to
> another template, or is specialized on to become a DTPT (defined template
> parameter type) can it be actually be used.
>
To this:
> A UTPT can be used when passing to another template, used in specialized,
> or other contexts where the TPT is not needed such as with size...(), as
> its actual TPT is not understood at that context level. Once passed to
> another template, or is specialized on to become a DTPT (defined template
> parameter type) can it be actually be used.
--
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/da507350-f918-4dd7-8bd6-a3300c66d666%40isocpp.org.
------=_Part_4968_200830976.1512933675576
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>Amending this line:=C2=A0</div><blockquote class=3D"g=
mail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc sol=
id;padding-left: 1ex;"><div dir=3D"ltr">A UTPT can only be passed to anothe=
r template or specialized on, as its actual meaning is not understood at th=
at context level. Once passed to another template, or is specialized on to=
become a DTPT (defined template parameter type) can it be actually be used=
.. <br></div></blockquote><div><br></div><div>To this:</div><div><blockquote=
class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px=
solid rgb(204, 204, 204); padding-left: 1ex;">A UTPT can be used when pass=
ing to another template, used in specialized, or other contexts where the T=
PT is not needed such as with size...(), as its actual TPT is not understoo=
d at that context level. Once passed to another template, or is specialized=
on to become a DTPT (defined template parameter type) can it be actually b=
e used.=C2=A0</blockquote><div><br></div></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/da507350-f918-4dd7-8bd6-a3300c66d666%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/da507350-f918-4dd7-8bd6-a3300c66d666=
%40isocpp.org</a>.<br />
------=_Part_4968_200830976.1512933675576--
------=_Part_4967_168499488.1512933675576--
.
Author: adrian.hawryluk@gmail.com
Date: Tue, 12 Dec 2017 21:08:16 -0800 (PST)
Raw View
------=_Part_14315_1994248636.1513141697020
Content-Type: multipart/alternative;
boundary="----=_Part_14316_704119374.1513141697021"
------=_Part_14316_704119374.1513141697021
Content-Type: text/plain; charset="UTF-8"
>
> On Sunday, December 10, 2017 at 11:20:01 AM UTC-5, bastie...@gmail.com
wrote:
> Adding a new keyword to the language is a pain. This is not big enough to
> grant such a pain.
>
It is the reason why I didn't suggest one.
As for the empty solution is not a great solution because the intent is
> absolutely unclear, it's not easy to read and is really not C++-like.
>
As I said before, please see my example before jumping to the conclusion
that *the intent is absolutely unclear*. I feel quite the opposite. If
you name what you are asking for, then you get what you asked for. If you
don't ask for something specifically, then you get what you get.
--
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/6d7eacd7-11c1-4ef7-af5c-c11bb620f7cb%40isocpp.org.
------=_Part_14316_704119374.1513141697021
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"></blockquote>=
On Sunday, December 10, 2017 at 11:20:01 AM UTC-5, bastie...@gmail.com wrot=
e:<br><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8=
ex;border-left: 1px #ccc solid;padding-left: 1ex;"><blockquote class=3D"gma=
il_quote" style=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(20=
4, 204, 204); padding-left: 1ex;"></blockquote><div dir=3D"ltr"><font face=
=3D"arial, sans-serif" size=3D"2">Adding a new keyword to the language is a=
pain. This is not big enough to grant such a pain.</font><div><font face=
=3D"arial, sans-serif" size=3D"2"></font></div></div></blockquote><div>It i=
s the reason why I didn't suggest one.</div><div><br></div><blockquote =
class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1p=
x #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><font face=3D"arial,=
sans-serif" size=3D"2">As for the empty solution is not a great solution b=
ecause the intent is absolutely=C2=A0unclear, it's not easy to read and=
is really not C++-like.<br></font></div></div></blockquote><div>As I said =
before, please see my example before jumping to the conclusion that <i>the =
intent is=C2=A0absolutely unclear</i>.=C2=A0 I feel quite the opposite.=C2=
=A0 If you name what you are asking for, then you get what you asked for.=
=C2=A0 If you don't ask for something specifically, then you get what y=
ou get.</div><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" 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/6d7eacd7-11c1-4ef7-af5c-c11bb620f7cb%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/6d7eacd7-11c1-4ef7-af5c-c11bb620f7cb=
%40isocpp.org</a>.<br />
------=_Part_14316_704119374.1513141697021--
------=_Part_14315_1994248636.1513141697020--
.
Author: adrian.hawryluk@gmail.com
Date: Tue, 12 Dec 2017 21:40:43 -0800 (PST)
Raw View
------=_Part_14230_1611143546.1513143643161
Content-Type: multipart/alternative;
boundary="----=_Part_14231_291063818.1513143643164"
------=_Part_14231_291063818.1513143643164
Content-Type: text/plain; charset="UTF-8"
*Suggested Proposal for Allowing Templates Take Unspecified Template
Parameter Types*
A UTPT (unspecified template parameter type) could be inserted into the
language without breakage of current code in the wild by using currently
illegal contexts, but is conceptually similar to how the current templating
system works, so should be easy to grasp to those who know it.
To define a UTPT, you specify a non-keyword identifier into the template
parameter list. This becomes the name of the UTPT. If the UTPT is not to be
referenced, then that parameter can be left blank. A UTPT parameter pack
can also be made by not stating the TPT (template parameter type) and just
specify ... (ellipsis) followed by an optional non-keyword identifier.
A UTPT can be used when passing to another template, used in specialized,
or other contexts where the TPT is not needed such as with size...(). Once
passed to another template, or is specialized on to become a DTPT (defined
template parameter type) can it be used in the way that it is currently
done in C++.
As an example of how it could be used, I'll specify a tbind class, which I
made, used to bind template parameters:
template <template <typename...> class OP, typename PARAMS, typename...Ts>
struct tbind_impl;
template <template <typename...> class OP, typename...Ss>
struct tbind_impl<OP, std::tuple<Ss...>>
{
template<typename...Us>
using ttype = OP<Ss...>;
};
template <template <typename...> class OP, typename T, typename...Ts,
typename...Ss>
struct tbind_impl<OP, std::tuple<Ss...>, T, Ts...>
{
template<typename...Us>
using ttype = typename tbind_impl<
OP
, std::tuple<Ss..., T>
, Ts...
>::template ttype<Us...>;
};
template <template <typename...> class OP, size_t I, typename...Ts, typename
....Ss>
struct tbind_impl<OP, std::tuple<Ss...>, std::integral_constant<size_t, I>,
Ts...>
{
template<typename...Us>
using ttype = typename tbind_impl<
OP
, typename std::tuple<
Ss...
, typename std::tuple_element<
I
, std::tuple<Us...>
>::type
>
, Ts...
>::template ttype<Us...>;
};
using t0 = std::integral_constant<size_t, 0>;
using t1 = std::integral_constant<size_t, 1>;
using t2 = std::integral_constant<size_t, 2>;
// ... other placeholders
template <template <typename...> class OP, typename...Ts>
struct tbind : tbind_impl<OP, std::tuple<>, Ts...>
{};
That is the original, and will only bind to TPTs of a typename. Now if
UTPTs were allowed, using the specification I suggested, we could do
something like this:
// A replacement for std::tuple for UTPTs
template <...>
struct UTPT_list {};
// A replacement for std::tuple_element for UTPTs
template <size_t I, size_t N, ...Ts>
UTPT_element_impl;
template <size_t I, size_t N, T, ...Ts>
UTPT_element_impl<I, N, Ts...>
: UTPT_element_impl<I+1, N, Ts...>
{};
template <size_t N, auto V, ...Ts>
UTPT_element_impl
{
static constexpr auto item = V;
};
template <size_t N, typename T, ...Ts>
UTPT_element_impl
{
using item = T;
};
template <size_t N, template<...> class TT, ...Ts>
UTPT_element_impl
{
template<...Us>
using item = TT<Us...>;
};
template <size_t N, ...Ts>
UTPT_element : UTPT_element_impl<0, N, Ts...> {};
template <template <...> class OP, typename PARAMS, ...Ts>
struct tbind_impl;
template <template <...> class OP, ...Ss>
struct tbind_impl<OP, UTPT_list<Ss...>>
{
template<...Us>
using ttype = OP<Ss...>;
};
template <template <...> class OP, T, ...Ts, ...Ss>
struct tbind_impl<OP, UTPT_list<Ss...>, T, Ts...>
{
template<...Us>
using ttype = typename tbind_impl<
OP
, UTPT_list<Ss..., T>
, Ts...
>::template ttype<Us...>;
};
template <template <...> class OP, size_t I, ...Ts, ...Ss>
struct tbind_impl<OP, UTPT_list<Ss...>, std::integral_constant<size_t, I>,
Ts...>
{
template<...Us>
using ttype = typename tbind_impl<
OP
, typename UTPT_list<
Ss...
, UTPT_element<I, Us...>::item
>
, Ts...
>::template ttype<Us...>;
};
using t0 = std::integral_constant<size_t, 0>;
using t1 = std::integral_constant<size_t, 1>;
using t2 = std::integral_constant<size_t, 2>;
// ... other placeholders
template <template <...> class OP, ...Ts>
struct tbind : tbind_impl<OP, UTPT_list<>, Ts...>
{};
Which would allow binding of any template parameter no matter if a template
parameter list consists of mixed TPTs.
Current usage would be:
// limited to templates that consist of only types
bool result = tbind<is_convertible, t0, long>::ttype<int>::value
// result == true
Where as it could be extended to something like this:
// these would result in a double type
tbind<UTPT_element, 2, t0, t1, t2>::ttype<int, float, double>>::item x = 1.3
;
tbind<UTPT_element, t0, t1, t2, double>::ttype<2, int, float>>::item x = 1.3
;
--
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/804f60dd-9448-4440-a7a3-3cb3f9cafa9c%40isocpp.org.
------=_Part_14231_291063818.1513143643164
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div><b><font size=3D"4">Suggested Proposal for Allowing T=
emplates Take Unspecified Template Parameter Types</font></b></div><div><br=
></div>A UTPT (unspecified template parameter type) could be inserted into =
the language without breakage of current code in the wild by using currentl=
y illegal contexts, but is conceptually similar to how the current templati=
ng system works, so should be easy to grasp to those who know it.=C2=A0<br>=
<br>To define a UTPT, you specify a non-keyword identifier into the templat=
e parameter list. This becomes the name of the UTPT. If the UTPT is not to =
be referenced, then that parameter can be left blank. A UTPT parameter pack=
can also be made by not stating the TPT (template parameter type) and just=
specify ... (ellipsis) followed by an optional non-keyword identifier.<br>=
<br>A UTPT can be used when passing to another template, used in specialize=
d, or other contexts where the TPT is not needed such as with <font face=3D=
"courier new, monospace">size...()</font>. Once passed to another template,=
or is specialized on to become a DTPT (defined template parameter type) ca=
n it be used in the way that it is currently done in C++.=C2=A0<div><br>As =
an example of how it could be used, I'll specify a tbind class, which I=
made, used to bind template parameters:</div><div><div class=3D"prettyprin=
t" style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 18=
7, 187); border-style: solid; border-width: 1px; word-wrap: break-word;"><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"><</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;" class=3D"style=
d-by-prettify"><</span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">typename</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">...></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: #000;" class=3D"styled-by-prettify"> OP</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">typename</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> PARAMS</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">typename</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">...</span><span style=3D"color: #606;" class=3D"styled-by-pr=
ettify">Ts</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
></span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">struct</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> tbind_impl</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></span><span sty=
le=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"><</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;" class=3D=
"styled-by-prettify"><</span><span style=3D"color: #008;" class=3D"style=
d-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"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>class</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> OP<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">typename</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">...</span><span style=3D"col=
or: #606;" class=3D"styled-by-prettify">Ss</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">></span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">struct</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> tbind_impl</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify"><</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify">OP</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify">tuple</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D=
"color: #606;" class=3D"styled-by-prettify">Ss</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 </span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">template</span><span style=3D"color: #660;"=
class=3D"styled-by-prettify"><</span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">typename</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">...</span><span style=3D"color: #606;" class=3D"sty=
led-by-prettify">Us</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">></span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">using</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> ttype </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> OP<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span>=
<span style=3D"color: #606;" class=3D"styled-by-prettify">Ss</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">...>;</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: #0=
00;" class=3D"styled-by-prettify"><br><br></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;" class=3D=
"styled-by-prettify"><</span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">template</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy"><</span><span style=3D"color: #008;" class=3D"styled-by-prettify">ty=
pename</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">class</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> OP</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">typename</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> T</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: #008;" class=3D"styled-by-prettify"=
>typename</span><span style=3D"color: #660;" class=3D"styled-by-prettify">.=
...</span><span style=3D"color: #606;" class=3D"styled-by-prettify">Ts</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">...</span><span style=3D"color: #606=
;" class=3D"styled-by-prettify">Ss</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">></span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">struct</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> tbind_impl</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify"><</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y">OP</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">tuple</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color: =
#606;" class=3D"styled-by-prettify">Ss</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">...>,</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">=
Ts</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 sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">template</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">typename</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">...</span><span style=3D"col=
or: #606;" class=3D"styled-by-prettify">Us</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">></span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">using</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> ttype </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">typename</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> tbind_impl</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify"><</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 OP<br>=C2=A0 =C2=A0 =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"> std</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify">tuple</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color: #606=
;" class=3D"styled-by-prettify">Ss</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">...,</span><span style=3D"color: #000;" class=3D"st=
yled-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"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #660;" cla=
ss=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">Ts</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
....</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=
=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>>::</span><span style=3D"color: #008;" class=3D"styled-by-prettify">tem=
plate</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> ttyp=
e</span><span style=3D"color: #660;" class=3D"styled-by-prettify"><</spa=
n><span style=3D"color: #606;" class=3D"styled-by-prettify">Us</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">...>;</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">};</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #0=
08;" 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"><</span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">template</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: #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"> </s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">class</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> OP</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> size_t I</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: #008;" class=
=3D"styled-by-prettify">typename</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">...</span><span style=3D"color: #606;" class=3D"sty=
led-by-prettify">Ts</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: #008;" class=3D"styled-by-prettify">typename<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">...</span><=
span style=3D"color: #606;" class=3D"styled-by-prettify">Ss</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">></span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color:=
#008;" class=3D"styled-by-prettify">struct</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> tbind_impl</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify"><</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">OP</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-prett=
ify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">tup=
le</span><span style=3D"color: #660;" class=3D"styled-by-prettify"><</sp=
an><span style=3D"color: #606;" class=3D"styled-by-prettify">Ss</span><span=
style=3D"color: #660;" class=3D"styled-by-prettify">...>,</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> std</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">integral_constant</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">size_t</span><span style=3D"color:=
#660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> I</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: #606;" class=3D"styled-by-pret=
tify">Ts</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><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">template</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">typename</span><span=
style=3D"color: #660;" class=3D"styled-by-prettify">...</span><span style=
=3D"color: #606;" class=3D"styled-by-prettify">Us</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">></span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">using</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> ttype </span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">typename</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> tbind_impl</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify"><</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 OP<br>=C2=A0 =C2=A0 =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><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">typename</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"colo=
r: #000;" class=3D"styled-by-prettify">tuple</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify"><</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 </span><span style=3D"color: #606;" class=3D"styled-by-prettify">Ss<=
/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 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
typename</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> s=
td</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify">tuple_element</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 I<br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =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"> std</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
">tuple</span><span style=3D"color: #660;" class=3D"styled-by-prettify"><=
;</span><span style=3D"color: #606;" class=3D"styled-by-prettify">Us</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">...></span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">>::</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify">type<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><spa=
n 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 =
=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><spa=
n style=3D"color: #606;" class=3D"styled-by-prettify">Ts</span><span style=
=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 </span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">>::</span><span style=3D=
"color: #008;" class=3D"styled-by-prettify">template</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> ttype</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color: #606=
;" class=3D"styled-by-prettify">Us</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"st=
yled-by-prettify">};</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br><br></span><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">using</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> t0 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify">integral_constant</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify">size_t</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #066;"=
class=3D"styled-by-prettify">0</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">>;</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">using</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> t1 </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> std</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">integral_constant</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify">size_t</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #06=
6;" 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"s=
tyled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-=
by-prettify">using</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> t2 </span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> std<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify">integral_constant</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify">size_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: #=
066;" class=3D"styled-by-prettify">2</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">>;</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"><br></span><span style=3D"color: #800;" class=3D"style=
d-by-prettify">// ... other placeholders</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">template</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify"><</span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">template</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: #008;" class=3D"styled-by-prettify">typena=
me</span><span style=3D"color: #660;" class=3D"styled-by-prettify">...><=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">class</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> OP</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: #008;" clas=
s=3D"styled-by-prettify">typename</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">...</span><span style=3D"color: #606;" class=3D"sty=
led-by-prettify">Ts</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">></span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">str=
uct</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> tbind =
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">:</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> tbind_impl</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify">OP</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify">tuple</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify"><>,</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prett=
ify">Ts</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><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div></=
code></div><div><br></div>That is the original, and will only bind to TPTs =
of a typename. Now if UTPTs were allowed, using the specification I suggest=
ed, we could do something like this:</div><div><div class=3D"prettyprint" s=
tyle=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 1=
87); border-style: solid; border-width: 1px; word-wrap: break-word;"><code =
class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #=
800;" class=3D"styled-by-prettify">// A replacement for std::tuple for UTPT=
s</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></spa=
n><span style=3D"color: #008;" class=3D"styled-by-prettify">template</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 st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D=
"color: #008;" class=3D"styled-by-prettify">struct</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> UTPT_list </span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">{};</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #800=
;" class=3D"styled-by-prettify">// A replacement for std::tuple_element for=
UTPTs</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">template</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">size_t I</span><span style=
=3D"color: #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">,</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: #606;" class=3D"styled-b=
y-prettify">Ts</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">></span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r>UTPT_element_impl</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: #008;" class=3D"styled-by-prettify">te=
mplate</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify">size_t I</span><spa=
n style=3D"color: #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">,</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-prettify"> </span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">...</span><span style=3D"color: #606;" class=3D"styled-by-prett=
ify">Ts</span><span style=3D"color: #660;" class=3D"styled-by-prettify">>=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>UTPT_=
element_impl</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
"><</span><span style=3D"color: #000;" class=3D"styled-by-prettify">I</s=
pan><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"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">Ts</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">...></span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br>=C2=A0 </span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">:</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> UTPT_element_impl</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify"><</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">I</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">+</span><span style=3D"color: #066;" class=3D"styled-by-prettify">1</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> N</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: #606;" clas=
s=3D"styled-by-prettify">Ts</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">...></span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">{};</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">t=
emplate</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">size_t N</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=
: #008;" class=3D"styled-by-prettify">auto</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> V</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: #660;" class=3D"styled-by-pret=
tify">...</span><span style=3D"color: #606;" class=3D"styled-by-prettify">T=
s</span><span style=3D"color: #660;" class=3D"styled-by-prettify">></spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>UTPT_elemen=
t_impl<br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=
=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>static</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">constexpr</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
style=3D"color: #008;" class=3D"styled-by-prettify">auto</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> item </span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> V</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">};</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"><br><br></span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">template</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #660;" class=3D"styled-by-prettify"><</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify">size_t N</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"colo=
r: #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-prettify"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">...</span><span style=3D"color: #606;" class=3D"styled-by-pr=
ettify">Ts</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
></span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>UT=
PT_element_impl<br></span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">using</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> item </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> T</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></span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">};</span><span style=3D"colo=
r: #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: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cla=
ss=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"st=
yled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
template</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&l=
t;...></span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">class</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> TT</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: #606;" c=
lass=3D"styled-by-prettify">Ts</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">></span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"><br>UTPT_element_impl<br></span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">template</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify"><...</span><span style=3D"color: #606;" class=
=3D"styled-by-prettify">Us</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">></span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">using</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> item </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> TT</span><span style=3D"color: #660;" class=3D"styled-by-prettify"><<=
/span><span style=3D"color: #606;" class=3D"styled-by-prettify">Us</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">...>;</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">};</span><span style=3D"col=
or: #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: =
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify"><</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify">size_t N</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: #660;" class=3D"styled-by-prettify"=
>...</span><span style=3D"color: #606;" class=3D"styled-by-prettify">Ts</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">></span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br>UTPT_element </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">:</span><span=
style=3D"color: #000;" class=3D"styled-by-prettify"> UTPT_element_impl</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><sp=
an style=3D"color: #066;" class=3D"styled-by-prettify">0</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"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">Ts</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">...></span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{};</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span>=
<span style=3D"color: #008;" class=3D"styled-by-prettify">template</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">template</span><span style=3D"colo=
r: #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: #008;" class=
=3D"styled-by-prettify">class</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> OP</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">typena=
me</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> PARAMS<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">...</span><span style=3D"col=
or: #606;" class=3D"styled-by-prettify">Ts</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">></span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">struct</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> tbind_impl</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br><br></span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">template</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify"><<=
/span><span style=3D"color: #008;" class=3D"styled-by-prettify">template</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
style=3D"color: #660;" class=3D"styled-by-prettify"><...></span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">class</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> OP</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: #660;" class=3D"sty=
led-by-prettify">...</span><span style=3D"color: #606;" class=3D"styled-by-=
prettify">Ss</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">></span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">struct</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> tbind_impl</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify">OP</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> UTPT_list</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color: #60=
6;" class=3D"styled-by-prettify">Ss</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">...>></span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">template</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify"><...</span><span style=3D"color: #606;" class=3D"styled=
-by-prettify">Us</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">></span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">using</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> ttype </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> OP</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><sp=
an style=3D"color: #606;" class=3D"styled-by-prettify">Ss</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"co=
lor: #660;" class=3D"styled-by-prettify">};</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br><br></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;" class=3D"=
styled-by-prettify"><</span><span style=3D"color: #008;" class=3D"styled=
-by-prettify">template</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y"><...></span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">class=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> OP</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"co=
lor: #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: #606;" class=3D"sty=
led-by-prettify">Ts</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=
><span style=3D"color: #606;" class=3D"styled-by-prettify">Ss</span><span s=
tyle=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: #008;" class=3D"styled-by-prettify">struct</span><span style=3D"color:=
#000;" class=3D"styled-by-prettify"> tbind_impl</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify">OP</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> UTPT_list</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify"><</span><span style=3D"color: #606;" class=3D"styled-by-p=
rettify">Ss</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>...>,</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-prettify"> </span><span styl=
e=3D"color: #606;" class=3D"styled-by-prettify">Ts</span><span style=3D"col=
or: #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 </span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">template</span><span style=3D"color: #660;"=
class=3D"styled-by-prettify"><...</span><span style=3D"color: #606;" cl=
ass=3D"styled-by-prettify">Us</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">></span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">using</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> ttype </span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">typ=
ename</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> tbin=
d_impl</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 =C2=A0 =C2=A0 OP<br>=C2=A0 =C2=A0 =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"> UTPT_list</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color=
: #606;" class=3D"styled-by-prettify">Ss</span><span style=3D"color: #660;"=
class=3D"styled-by-prettify">...,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> T</span><span style=3D"color: #660;" class=3D"styl=
ed-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">,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"style=
d-by-prettify">Ts</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-pr=
ettify">>::</span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">template</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> ttype</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&l=
t;</span><span style=3D"color: #606;" class=3D"styled-by-prettify">Us</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"=
color: #000;" class=3D"styled-by-prettify"><br><br></span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">template</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;"=
class=3D"styled-by-prettify"><</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;" class=3D"style=
d-by-prettify"><...></span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">class</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> OP</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> size_t I</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: #660;" class=3D"styled-by-prettify">...</span><span style=3D"color: #=
606;" class=3D"styled-by-prettify">Ts</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">...</span><span style=3D"color: #606;" class=3D"styled-by-prettify=
">Ss</span><span style=3D"color: #660;" class=3D"styled-by-prettify">></=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span=
style=3D"color: #000;" class=3D"styled-by-prettify"> tbind_impl</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">OP</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> UTPT_list</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify"><</span><span style=3D"color: #606;" clas=
s=3D"styled-by-prettify">Ss</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">...>,</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> std</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
>integral_constant</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify"><</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
">size_t</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> I</span><s=
pan 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">Ts</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">...></span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br></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>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">template</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify"><...</span><span style=3D"color: #606;" class=3D=
"styled-by-prettify">Us</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">></span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">using</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> ttype </span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">typename<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> tbind_impl=
</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 =C2=A0 =C2=A0 OP<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </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: #008;=
" class=3D"styled-by-prettify">typename</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> UTPT_list</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 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 </span><span style=3D"color: #606;" class=3D"styled-by-prettify">Ss</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">...</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> UTPT_element</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify"><</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y">I</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #606;" class=3D"styled-by-prettify">Us</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">...>::</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">item<br>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>></span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">=
Ts</span><span style=3D"color: #660;" class=3D"styled-by-prettify">...</spa=
n><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: #008;" class=3D"styled-by-prettify">template</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> ttype</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span=
style=3D"color: #606;" class=3D"styled-by-prettify">Us</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"co=
lor: #660;" class=3D"styled-by-prettify">};</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">using</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> t0 </span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> std</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify">i=
ntegral_constant</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify"><</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
size_t</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
style=3D"color: #066;" class=3D"styled-by-prettify">0</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">>;</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">using</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> t1 </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> std</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y">integral_constant</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify"><</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">size_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: #066;" class=3D"styled-by-prettify">1</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">>;</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color:=
#008;" class=3D"styled-by-prettify">using</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> t2 </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> std</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">integral_constant</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify"><</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">size_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: #066;" class=3D"styled-by-prettify">2</span><span st=
yle=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: #800;" class=3D"styled-by-prettify">// ... other placeholders</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><spa=
n 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"><</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"><...></span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">class</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> OP</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">...</span><s=
pan style=3D"color: #606;" class=3D"styled-by-prettify">Ts</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">></span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: =
#008;" class=3D"styled-by-prettify">struct</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> tbind </span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">:</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> tbind_impl</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify"><</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">OP</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> U=
TPT_list</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&l=
t;>,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #606;" class=3D"styled-by-prettify">Ts</span><sp=
an 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=
><div><br></div></div><div>Which would allow binding of any template parame=
ter no matter if a template parameter list consists of mixed TPTs.<br></div=
><div><div><br></div><div>Current usage would be:<br><div style=3D"border-w=
idth: 1px; border-style: solid; border-color: rgb(187, 187, 187); backgroun=
d-color: rgb(250, 250, 250); word-wrap: break-word;"><code><div class=3D"F0=
XO1GC-Db-b"><span style=3D"color: rgb(136, 0, 0);">// limited to templates =
that consist of only types</span><span style=3D"color: rgb(0, 0, 0);"><br><=
/span></div><span style=3D"color: rgb(0, 0, 136);">bool</span><span style=
=3D"color: rgb(0, 0, 0);">=C2=A0result=C2=A0</span><span style=3D"color: rg=
b(102, 102, 0);">=3D</span><span style=3D"color: rgb(0, 0, 0);">=C2=A0tbind=
</span><span style=3D"color: rgb(102, 102, 0);"><</span><span style=3D"c=
olor: rgb(0, 0, 0);">is_convertible</span><span style=3D"color: rgb(102, 10=
2, 0);">,</span><span style=3D"color: rgb(0, 0, 0);">=C2=A0t0</span><span s=
tyle=3D"color: rgb(102, 102, 0);">,</span><span style=3D"color: rgb(0, 0, 0=
);">=C2=A0</span><span style=3D"color: rgb(0, 0, 136);">long</span><span st=
yle=3D"color: rgb(102, 102, 0);">>::</span><span style=3D"color: rgb(0, =
0, 0);">ttype</span><span style=3D"color: rgb(0, 136, 0);"><int></spa=
n><span style=3D"color: rgb(102, 102, 0);">::</span><span style=3D"color: r=
gb(0, 0, 0);">value<br></span><span style=3D"color: rgb(136, 0, 0);">// res=
ult =3D=3D true</span></code></div></div><div><br></div><div>Where as it co=
uld be extended to something like this:<br><div style=3D"border-width: 1px;=
border-style: solid; border-color: rgb(187, 187, 187); background-color: r=
gb(250, 250, 250); word-wrap: break-word;"><code><span style=3D"color: rgb(=
136, 0, 0);">// these would result in a double type</span><span style=3D"co=
lor: rgb(0, 0, 0);"><br>tbind</span><span style=3D"color: rgb(102, 102, 0);=
"><</span><span style=3D"color: rgb(0, 0, 0);">UTPT_element</span><span =
style=3D"color: rgb(102, 102, 0);">,</span><span style=3D"color: rgb(0, 0, =
0);">=C2=A0</span><span style=3D"color: rgb(0, 102, 102);">2</span><span st=
yle=3D"color: rgb(102, 102, 0);">,</span><span style=3D"color: rgb(0, 0, 0)=
;">=C2=A0t0</span><span style=3D"color: rgb(102, 102, 0);">,</span><span st=
yle=3D"color: rgb(0, 0, 0);">=C2=A0t1</span><span style=3D"color: rgb(102, =
102, 0);">,</span><span style=3D"color: rgb(0, 0, 0);">=C2=A0t2</span><span=
style=3D"color: rgb(102, 102, 0);">>::</span><span style=3D"color: rgb(=
0, 0, 0);">ttype</span><span style=3D"color: rgb(102, 102, 0);"><</span>=
<span style=3D"color: rgb(0, 0, 136);">int</span><span style=3D"color: rgb(=
102, 102, 0);">,</span><span style=3D"color: rgb(0, 0, 0);">=C2=A0</span><s=
pan style=3D"color: rgb(0, 0, 136);">float</span><span style=3D"color: rgb(=
102, 102, 0);">,</span><span style=3D"color: rgb(0, 0, 0);">=C2=A0</span><s=
pan style=3D"color: rgb(0, 0, 136);">double</span><span style=3D"color: rgb=
(102, 102, 0);">>>::</span><span style=3D"color: rgb(0, 0, 0);">item =
x=C2=A0</span><span style=3D"color: rgb(102, 102, 0);">=3D</span><span styl=
e=3D"color: rgb(0, 0, 0);">=C2=A0</span><span style=3D"color: rgb(0, 102, 1=
02);">1.3</span><span style=3D"color: rgb(102, 102, 0);">;</span><span styl=
e=3D"color: rgb(0, 0, 0);"><br>tbind</span><span style=3D"color: rgb(102, 1=
02, 0);"><</span><span style=3D"color: rgb(0, 0, 0);">UTPT_element</span=
><span style=3D"color: rgb(102, 102, 0);">,</span><span style=3D"color: rgb=
(0, 0, 0);">=C2=A0t0</span><span style=3D"color: rgb(102, 102, 0);">,</span=
><span style=3D"color: rgb(0, 0, 0);">=C2=A0t1</span><span style=3D"color: =
rgb(102, 102, 0);">,</span><span style=3D"color: rgb(0, 0, 0);">=C2=A0t2</s=
pan><span style=3D"color: rgb(102, 102, 0);">,</span><span style=3D"color: =
rgb(0, 0, 0);">=C2=A0</span><span style=3D"color: rgb(0, 0, 136);">double</=
span><span style=3D"color: rgb(102, 102, 0);">>::</span><span style=3D"c=
olor: rgb(0, 0, 0);">ttype</span><span style=3D"color: rgb(102, 102, 0);">&=
lt;</span><span style=3D"color: rgb(0, 102, 102);">2</span><span style=3D"c=
olor: rgb(102, 102, 0);">,</span><span style=3D"color: rgb(0, 0, 0);">=C2=
=A0</span><span style=3D"color: rgb(0, 0, 136);">int</span><span style=3D"c=
olor: rgb(102, 102, 0);">,</span><span style=3D"color: rgb(0, 0, 0);">=C2=
=A0</span><span style=3D"color: rgb(0, 0, 136);">float</span><span style=3D=
"color: rgb(102, 102, 0);">>>::</span><span style=3D"color: rgb(0, 0,=
0);">item x=C2=A0</span><span style=3D"color: rgb(102, 102, 0);">=3D</span=
><span style=3D"color: rgb(0, 0, 0);">=C2=A0</span><span style=3D"color: rg=
b(0, 102, 102);">1.3</span><span style=3D"color: rgb(102, 102, 0);">;</span=
><span style=3D"color: rgb(0, 0, 0);"><br></span></code></div></div><div><c=
ode><span style=3D"color: rgb(102, 102, 0);"><br></span></code></div></div>=
</div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/804f60dd-9448-4440-a7a3-3cb3f9cafa9c%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/804f60dd-9448-4440-a7a3-3cb3f9cafa9c=
%40isocpp.org</a>.<br />
------=_Part_14231_291063818.1513143643164--
------=_Part_14230_1611143546.1513143643161--
.
Author: adrian.hawryluk@gmail.com
Date: Tue, 12 Dec 2017 22:03:20 -0800 (PST)
Raw View
------=_Part_14457_27703973.1513145000834
Content-Type: multipart/alternative;
boundary="----=_Part_14458_1218292222.1513145000834"
------=_Part_14458_1218292222.1513145000834
Content-Type: text/plain; charset="UTF-8"
Just to note, it is trivial to determine what type the TPT is using
specialization:
// Note that the name UTPT here is optional, just like it would be for a
regular template to be specialized
template <UTPT>
struct is_template : std::false_type {};
// This is a specialization that can take a template that can take any
number of UTPT.
template <template <...> TT>
struct is_template<TT> : std::true_type {};
I'll leave the rest of the is_* TPT checkers up to the reader.
--
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/2fd12873-4abb-4c9b-bc00-7ca830957005%40isocpp.org.
------=_Part_14458_1218292222.1513145000834
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Just to note, it is trivial to determine what type the TPT=
is using specialization:<div class=3D"prettyprint" style=3D"background-col=
or: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: sol=
id; border-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint">=
<div class=3D"subprettyprint"><span style=3D"color: #800;" class=3D"styled-=
by-prettify">// Note that the name UTPT here is optional, just like it woul=
d be for a regular template to be specialized</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" =
class=3D"styled-by-prettify">template</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify"><</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">UTPT</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">></span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">struct=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> is_templa=
te </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">false_type </span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">{};</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br><br></span><span style=3D"colo=
r: #800;" class=3D"styled-by-prettify">// This is a specialization that can=
take a template that can take any number of U</span><span style=3D"color: =
#800;" class=3D"styled-by-prettify">TPT.</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"><br></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;" class=3D"style=
d-by-prettify"><</span><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: #000;" class=3D"styled-by-prettify"> =
TT</span><span style=3D"color: #660;" class=3D"styled-by-prettify">></sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> is_template</span><span=
style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">TT</span><span style=3D"colo=
r: #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"> std</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
>true_type </span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>{};</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></=
span></div></code></div><div><br></div><div>I'll leave the rest of the =
<font face=3D"courier new, monospace">is_*</font> TPT checkers up to the re=
ader.</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/2fd12873-4abb-4c9b-bc00-7ca830957005%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/2fd12873-4abb-4c9b-bc00-7ca830957005=
%40isocpp.org</a>.<br />
------=_Part_14458_1218292222.1513145000834--
------=_Part_14457_27703973.1513145000834--
.
Author: inkwizytoryankes@gmail.com
Date: Wed, 13 Dec 2017 12:06:54 -0800 (PST)
Raw View
------=_Part_257_1790786523.1513195614767
Content-Type: multipart/alternative;
boundary="----=_Part_258_652167659.1513195614767"
------=_Part_258_652167659.1513195614767
Content-Type: text/plain; charset="UTF-8"
On Wednesday, December 13, 2017 at 7:03:20 AM UTC+1, adrian....@gmail.com
wrote:
>
> Just to note, it is trivial to determine what type the TPT is using
> specialization:
> // Note that the name UTPT here is optional, just like it would be for a
> regular template to be specialized
> template <UTPT>
> struct is_template : std::false_type {};
>
> // This is a specialization that can take a template that can take any
> number of UTPT.
> template <template <...> TT>
> struct is_template<TT> : std::true_type {};
>
> I'll leave the rest of the is_* TPT checkers up to the reader.
>
Some time ago I participate in discussion of similar feature. One
difference was that was using `using` keyword to introduce unknown type of
template parameters. I think use in this context will be consisting with
rest of language because you can `using` not only types but function too.
--
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/96475f1a-852e-4f8a-ba56-7b6a172d5f6e%40isocpp.org.
------=_Part_258_652167659.1513195614767
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Wednesday, December 13, 2017 at 7:03:20 AM UTC+=
1, adrian....@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"ma=
rgin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">=
<div dir=3D"ltr">Just to note, it is trivial to determine what type the TPT=
is using specialization:<div style=3D"background-color:rgb(250,250,250);bo=
rder-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:b=
reak-word"><code><div><span style=3D"color:#800">// Note that the name UTPT=
here is optional, just like it would be for a regular template to be speci=
alized</span><span style=3D"color:#000"><br></span><span style=3D"color:#00=
8">template</span><span style=3D"color:#000"> </span><span style=3D"color:#=
660"><</span><span style=3D"color:#000">UTPT</span><span style=3D"color:=
#660">></span><span style=3D"color:#000"><br></span><span style=3D"color=
:#008">struct</span><span style=3D"color:#000"> is_template </span><span st=
yle=3D"color:#660">:</span><span style=3D"color:#000"> std</span><span styl=
e=3D"color:#660">::</span><span style=3D"color:#000">false_type </span><spa=
n style=3D"color:#660">{};</span><span style=3D"color:#000"><br><br></span>=
<span style=3D"color:#800">// This is a specialization that can take a temp=
late that can take any number of U</span><span style=3D"color:#800">TPT.</s=
pan><span style=3D"color:#000"><br></span><span style=3D"color:#008">templa=
te</span><span style=3D"color:#000"> </span><span style=3D"color:#660"><=
</span><span style=3D"color:#008">template</span><span style=3D"color:#000"=
> </span><span style=3D"color:#660"><...></span><span style=3D"color:=
#000"> TT</span><span style=3D"color:#660">></span><span style=3D"color:=
#000"><br></span><span style=3D"color:#008">struct</span><span style=3D"col=
or:#000"> is_template</span><span style=3D"color:#660"><</span><span sty=
le=3D"color:#000">TT</span><span style=3D"color:#660">></span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#660">:</span><span style=3D"=
color:#000"> std</span><span style=3D"color:#660">::</span><span style=3D"c=
olor:#000">true_type </span><span style=3D"color:#660">{};</span><span styl=
e=3D"color:#000"><br></span></div></code></div><div><br></div><div>I'll=
leave the rest of the <font face=3D"courier new, monospace">is_*</font> TP=
T checkers up to the reader.</div></div></blockquote><div><br></div><div>So=
me time ago I participate in discussion of similar feature. One difference =
was that was using `using` keyword to introduce unknown type of template pa=
rameters. I think use in this context will be consisting with rest of langu=
age because you can `using` not only types but function too.<br></div></div=
>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/96475f1a-852e-4f8a-ba56-7b6a172d5f6e%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/96475f1a-852e-4f8a-ba56-7b6a172d5f6e=
%40isocpp.org</a>.<br />
------=_Part_258_652167659.1513195614767--
------=_Part_257_1790786523.1513195614767--
.
Author: adrian.hawryluk@gmail.com
Date: Wed, 13 Dec 2017 12:45:07 -0800 (PST)
Raw View
------=_Part_355_78601958.1513197907198
Content-Type: multipart/alternative;
boundary="----=_Part_356_299488791.1513197907198"
------=_Part_356_299488791.1513197907198
Content-Type: text/plain; charset="UTF-8"
>
> Some time ago I participate in discussion of similar feature. One
> difference was that was using `using` keyword to introduce unknown type of
> template parameters. I think use in this context will be consisting with
> rest of language because you can `using` not only types but function too.
>
Well, I think using is better keyword to use than the bare template keyword
IMHO. When I see template, I just expect to see a template there, not any
TPT. Other alternatives I considered were auto, as it would automatically
match any TPT, but that is currently in use now, and * (asterix), which is
like a glob that matches everything. The use of no keyword was a fairly
obvious mnemonic, I didn't specify what TPT, so allow any TPT.
Quite honestly, I don't really mind any of these alternatives, but I think
that we should not be limited like we are now. This feature is a long time
coming and should be added to the language.
What other differences were there in the other discussion you had? What
reason was given to blockade this type of feature?
--
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/88f6b347-82b7-4a06-91dc-3fad72122ae9%40isocpp.org.
------=_Part_356_299488791.1513197907198
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><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"><div>Some time ago I participate in discussion of similar feature. One =
difference was that was using `using` keyword to introduce unknown type of =
template parameters. I think use in this context will be consisting with re=
st of language because you can `using` not only types but function too.<br>=
</div></div></blockquote><div><br></div><div>Well, I think <font face=3D"co=
urier new, monospace">using </font>is better keyword to use than the bare <=
font face=3D"courier new, monospace">template </font>keyword IMHO.=C2=A0 =
=C2=A0When I see <font face=3D"courier new, monospace">template</font>, I j=
ust expect to see a template there, not any TPT.=C2=A0 Other alternatives I=
considered were <font face=3D"courier new, monospace">auto</font>, as it w=
ould automatically match any TPT, but that is currently in use now, and <fo=
nt face=3D"courier new, monospace">*</font><font face=3D"arial, sans-serif"=
> (asterix)</font>, which is like a glob that matches everything.=C2=A0 The=
use of no keyword was a fairly obvious mnemonic, I didn't specify what=
TPT, so allow any TPT.</div><div><br></div><div>Quite honestly, I don'=
t really mind any of these alternatives, but I think that we should not be =
limited like we are now.=C2=A0 This feature is a long time coming and shoul=
d be added to the language.</div><div><br></div><div>What other differences=
were there in the other discussion you had?=C2=A0 What reason was given to=
blockade this type of feature?</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/88f6b347-82b7-4a06-91dc-3fad72122ae9%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/88f6b347-82b7-4a06-91dc-3fad72122ae9=
%40isocpp.org</a>.<br />
------=_Part_356_299488791.1513197907198--
------=_Part_355_78601958.1513197907198--
.
Author: Mingxin Wang <wmx16835vv@163.com>
Date: Wed, 13 Dec 2017 19:09:40 -0800 (PST)
Raw View
------=_Part_1132_170892619.1513220981058
Content-Type: multipart/alternative;
boundary="----=_Part_1133_304269072.1513220981058"
------=_Part_1133_304269072.1513220981058
Content-Type: text/plain; charset="UTF-8"
On Thursday, December 14, 2017 at 4:45:07 AM UTC+8, adrian....@gmail.com
wrote:
>
> Some time ago I participate in discussion of similar feature. One
>> difference was that was using `using` keyword to introduce unknown type of
>> template parameters. I think use in this context will be consisting with
>> rest of language because you can `using` not only types but function too.
>>
>
> Well, I think using is better keyword to use than the bare template keyword
> IMHO. When I see template, I just expect to see a template there, not
> any TPT. Other alternatives I considered were auto, as it would
> automatically match any TPT, but that is currently in use now, and *
> (asterix), which is like a glob that matches everything. The use of no
> keyword was a fairly obvious mnemonic, I didn't specify what TPT, so allow
> any TPT.
>
> Quite honestly, I don't really mind any of these alternatives, but I think
> that we should not be limited like we are now. This feature is a long time
> coming and should be added to the language.
>
> What other differences were there in the other discussion you had? What
> reason was given to blockade this type of feature?
>
I think "allowing any parameter in a template" is a common demand,
especially in compile-time programming.
With the standard we have now, one is always required to specify the types
of the parameters declared in a template. In order to define the semantics
of the template explicitly, the class template `std::integral_constant` was
introduced, so that users are able to pass any integral constants with the
template. However, I think `integral_constant` is inappropriately named,
and there seem to be little necessity in defining any member types or
constants in it, because these metadata is already passed by templates.
In order to standardize the expressions to pass various sort of metadata to
templates, the class templates `in_place_arg_t` and `in_place_resource_t`
were proposed in one of my earlier posts
(https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/Gb3CFKiGLfo)
and in my recent proposal p0801
(http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0801r0.pdf).
What do you think of my solution? I am looking forward to your comments and
suggestions.
Mingxin Wang
--
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/41bdec82-f70c-4c16-a0db-9eb665e4b77d%40isocpp.org.
------=_Part_1133_304269072.1513220981058
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Thursday, December 14, 2017 at 4:45:07 AM UTC+8, adrian=
.....@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;m=
argin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr"><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"><div>Some=
time ago I participate in discussion of similar feature. One difference wa=
s that was using `using` keyword to introduce unknown type of template para=
meters. I think use in this context will be consisting with rest of languag=
e because you can `using` not only types but function too.<br></div></div><=
/blockquote><div><br></div><div>Well, I think <font face=3D"courier new, mo=
nospace">using </font>is better keyword to use than the bare <font face=3D"=
courier new, monospace">template </font>keyword IMHO.=C2=A0 =C2=A0When I se=
e <font face=3D"courier new, monospace">template</font>, I just expect to s=
ee a template there, not any TPT.=C2=A0 Other alternatives I considered wer=
e <font face=3D"courier new, monospace">auto</font>, as it would automatica=
lly match any TPT, but that is currently in use now, and <font face=3D"cour=
ier new, monospace">*</font><font face=3D"arial, sans-serif"> (asterix)</fo=
nt>, which is like a glob that matches everything.=C2=A0 The use of no keyw=
ord was a fairly obvious mnemonic, I didn't specify what TPT, so allow =
any TPT.</div><div><br></div><div>Quite honestly, I don't really mind a=
ny of these alternatives, but I think that we should not be limited like we=
are now.=C2=A0 This feature is a long time coming and should be added to t=
he language.</div><div><br></div><div>What other differences were there in =
the other discussion you had?=C2=A0 What reason was given to blockade this =
type of feature?</div></div></blockquote><div><br></div><div>I think "=
allowing any parameter in a template" is a common demand, especially i=
n compile-time programming.</div><div><br></div><div>With the standard we h=
ave now, one is always required to specify the types of the parameters decl=
ared in a template. In order to define the semantics of the template explic=
itly, the class template `std::integral_constant` was introduced, so that u=
sers are able to pass any integral constants with the template.=C2=A0Howeve=
r, I think `integral_constant` is inappropriately named, and there seem to =
be little necessity in defining any member types or constants in it, becaus=
e these metadata is already passed by templates.</div><div><br></div><div>I=
n order to standardize the expressions to pass various sort of metadata to =
templates, the class templates `in_place_arg_t` and `in_place_resource_t` w=
ere proposed in one of my earlier posts (https://groups.google.com/a/isocpp=
..org/forum/#!topic/std-proposals/Gb3CFKiGLfo) and in my recent proposal p08=
01 (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0801r0.pdf).</=
div><div><br></div><div>What do you think of my solution? I am looking forw=
ard to your comments and suggestions.<br></div><div><br></div><div>Mingxin =
Wang</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/41bdec82-f70c-4c16-a0db-9eb665e4b77d%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/41bdec82-f70c-4c16-a0db-9eb665e4b77d=
%40isocpp.org</a>.<br />
------=_Part_1133_304269072.1513220981058--
------=_Part_1132_170892619.1513220981058--
.
Author: bastienpenava@gmail.com
Date: Thu, 14 Dec 2017 00:31:02 -0800 (PST)
Raw View
------=_Part_1839_1523883449.1513240262865
Content-Type: multipart/alternative;
boundary="----=_Part_1840_70241395.1513240262865"
------=_Part_1840_70241395.1513240262865
Content-Type: text/plain; charset="UTF-8"
I'm sorry but more of the same is not going to help here.
A library solution doesn't help.
std::integral_constant & affiliated solutions are generally extremely
clunky and require the user of to work for the solution to be functional.
I actually disagree on your statement that's it's not possible.
The only issue with it is C++ parsing and there is a simple solution.
I proposed it in an earlier thread, that said "universal template
parameter" ought to behave as dependent members:
-implicitly value.
-requires prefix "typename" if used, or tried to be used, as type.
-requires prefix "template" if is a template template parameter.
With the difference that when giving such an argument to a template
instantiation list the value/type must be substituted for the parsed one.
Ex:
template<template T>
constexpr auto func()
{
if constexpr (requires() { T; })
return T;
else if constexpr (requires() { typename T; })
return typename T{};
else
return template T<>{};
}
template<template T>
constexpr void x()
{
func<T>(); //is pre-parsed as a dependent template argument. T is then
substituted on instantiation by its actual value.
}
int main(){
x<42>(); //ok
x<int>(); //ok
}
Having seen from close GCC implementation I believe it's technically doable.
On the syntax front I disagree on the use of "using" and the justification
behind it.
"using" has one meaning : name substitution. With namespaces, classes and
functions. NOT values.
"template" is actually more appropriate.
Template only means canvas, to be substituted by.
You can template any kind of definition.
Using "template" as a universal template argument seems more intuitive than
"using".
"template" in a template parameter list would simply mean:
a parameter-less template, something to be resolved as template doesn't
infer what is actually templated.
On Thursday, December 14, 2017 at 4:09:41 AM UTC+1, Mingxin Wang wrote:
>
> On Thursday, December 14, 2017 at 4:45:07 AM UTC+8, adrian....@gmail.com
> wrote:
>>
>> Some time ago I participate in discussion of similar feature. One
>>> difference was that was using `using` keyword to introduce unknown type of
>>> template parameters. I think use in this context will be consisting with
>>> rest of language because you can `using` not only types but function too.
>>>
>>
>> Well, I think using is better keyword to use than the bare template keyword
>> IMHO. When I see template, I just expect to see a template there, not
>> any TPT. Other alternatives I considered were auto, as it would
>> automatically match any TPT, but that is currently in use now, and *
>> (asterix), which is like a glob that matches everything. The use of no
>> keyword was a fairly obvious mnemonic, I didn't specify what TPT, so allow
>> any TPT.
>>
>> Quite honestly, I don't really mind any of these alternatives, but I
>> think that we should not be limited like we are now. This feature is a
>> long time coming and should be added to the language.
>>
>> What other differences were there in the other discussion you had? What
>> reason was given to blockade this type of feature?
>>
>
> I think "allowing any parameter in a template" is a common demand,
> especially in compile-time programming.
>
> With the standard we have now, one is always required to specify the types
> of the parameters declared in a template. In order to define the semantics
> of the template explicitly, the class template `std::integral_constant` was
> introduced, so that users are able to pass any integral constants with the
> template. However, I think `integral_constant` is inappropriately named,
> and there seem to be little necessity in defining any member types or
> constants in it, because these metadata is already passed by templates.
>
> In order to standardize the expressions to pass various sort of metadata
> to templates, the class templates `in_place_arg_t` and
> `in_place_resource_t` were proposed in one of my earlier posts (
> https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/Gb3CFKiGLfo)
> and in my recent proposal p0801 (
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0801r0.pdf).
>
> What do you think of my solution? I am looking forward to your comments
> and suggestions.
>
> Mingxin Wang
>
--
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/be6246f6-c7f4-4b58-81b4-6eaa1e59af55%40isocpp.org.
------=_Part_1840_70241395.1513240262865
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">I'm sorry but more of the same is not going to help he=
re.<div>A library solution doesn't help.</div><div>std::integral_consta=
nt & affiliated solutions are generally extremely clunky and require th=
e user of to work for the solution to be functional.</div><div><br></div><d=
iv>I actually disagree on your statement that's it's not possible.<=
/div><div>The only issue with it is C++ parsing and there is a simple solut=
ion.</div><div>I proposed it in an earlier thread, that said "universa=
l template parameter" ought to behave as dependent members:</div><div>=
-implicitly value.<br></div><div>-requires prefix "typename" if u=
sed, or tried to be used, as type.</div><div>-requires prefix "templat=
e" if is a template template parameter.</div><div><br></div><div>With =
the difference that when giving such an argument to a template instantiatio=
n list the value/type must be substituted for the parsed one.</div><div><br=
></div><div>Ex:</div><div class=3D"prettyprint" style=3D"background-color: =
rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; =
border-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div=
class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">template</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify"><</span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>template</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
T</span><span style=3D"color: #660;" class=3D"styled-by-prettify">></spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">constexpr</span><span=
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D=
"color: #008;" class=3D"styled-by-prettify">auto</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> =C2=A0func</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">()</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">if</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">constexpr</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify">requires</sp=
an><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"> T</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">})</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">return</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"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">else</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">if</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">constexpr</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">requires</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">()</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">ty=
pename</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> T</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">})</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">return</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=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"colo=
r: #660;" class=3D"styled-by-prettify">{};</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">else</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br>=C2=A0 =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"> </span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">template</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"color: #66=
0;" 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><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br><br></span><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">template</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify"><</span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">template</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> T</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&=
gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">constexpr</sp=
an><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"> x</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">()</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br>=C2=A0 =C2=A0func</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify"><</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-p=
rettify"> </span><span style=3D"color: #800;" class=3D"styled-by-prettify">=
//is pre-parsed as a dependent template argument. T is then substituted on =
instantiation by its actual value.</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></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></span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">int</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
main</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=A0x</span><span style=3D"color: #660;" class=3D"styled-by-prettify"><=
;</span><span style=3D"color: #066;" class=3D"styled-by-prettify">42</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">>();</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #800;" class=3D"styled-by-prettify">//ok</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0x</span><span sty=
le=3D"color: #080;" class=3D"styled-by-prettify"><int></span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">();</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #8=
00;" class=3D"styled-by-prettify">//ok</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">}</span></div></code></div><div><br></div><div>Havi=
ng seen from close GCC implementation I believe it's technically doable=
..</div><div><br></div><div>On the syntax front I disagree on the use of &qu=
ot;using" and the justification behind it.</div><div>"using"=
has one meaning : name substitution. With namespaces, classes and function=
s. NOT values.</div><div>"template" is actually more appropriate.=
</div><div>Template only means canvas, to be substituted by.</div><div>You =
can template any kind of definition.</div><div>Using "template" a=
s a universal template argument seems more intuitive than "using"=
..</div><div>"template" in a template parameter list would simply =
mean:</div><div>a parameter-less template, something to be resolved as temp=
late doesn't infer what is actually templated.</div><div><br>On Thursda=
y, December 14, 2017 at 4:09:41 AM UTC+1, Mingxin Wang wrote:<blockquote cl=
ass=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px =
#ccc solid;padding-left: 1ex;"><div dir=3D"ltr">On Thursday, December 14, 2=
017 at 4:45:07 AM UTC+8, <a>adrian....@gmail.com</a> wrote:<blockquote clas=
s=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc =
solid;padding-left:1ex"><div dir=3D"ltr"><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"><div>Some time ago I participate in discussion of si=
milar feature. One difference was that was using `using` keyword to introdu=
ce unknown type of template parameters. I think use in this context will be=
consisting with rest of language because you can `using` not only types bu=
t function too.<br></div></div></blockquote><div><br></div><div>Well, I thi=
nk <font face=3D"courier new, monospace">using </font>is better keyword to =
use than the bare <font face=3D"courier new, monospace">template </font>key=
word IMHO.=C2=A0 =C2=A0When I see <font face=3D"courier new, monospace">tem=
plate</font>, I just expect to see a template there, not any TPT.=C2=A0 Oth=
er alternatives I considered were <font face=3D"courier new, monospace">aut=
o</font>, as it would automatically match any TPT, but that is currently in=
use now, and <font face=3D"courier new, monospace">*</font><font face=3D"a=
rial, sans-serif"> (asterix)</font>, which is like a glob that matches ever=
ything.=C2=A0 The use of no keyword was a fairly obvious mnemonic, I didn&#=
39;t specify what TPT, so allow any TPT.</div><div><br></div><div>Quite hon=
estly, I don't really mind any of these alternatives, but I think that =
we should not be limited like we are now.=C2=A0 This feature is a long time=
coming and should be added to the language.</div><div><br></div><div>What =
other differences were there in the other discussion you had?=C2=A0 What re=
ason was given to blockade this type of feature?</div></div></blockquote><d=
iv><br></div><div>I think "allowing any parameter in a template" =
is a common demand, especially in compile-time programming.</div><div><br><=
/div><div>With the standard we have now, one is always required to specify =
the types of the parameters declared in a template. In order to define the =
semantics of the template explicitly, the class template `std::integral_con=
stant` was introduced, so that users are able to pass any integral constant=
s with the template.=C2=A0However, I think `integral_constant` is inappropr=
iately named, and there seem to be little necessity in defining any member =
types or constants in it, because these metadata is already passed by templ=
ates.</div><div><br></div><div>In order to standardize the expressions to p=
ass various sort of metadata to templates, the class templates `in_place_ar=
g_t` and `in_place_resource_t` were proposed in one of my earlier posts (<a=
href=3D"https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals=
/Gb3CFKiGLfo" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=
=3D'https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/=
Gb3CFKiGLfo';return true;" onclick=3D"this.href=3D'https://groups.g=
oogle.com/a/isocpp.org/forum/#!topic/std-proposals/Gb3CFKiGLfo';return =
true;">https://groups.google.com/a/<wbr>isocpp.org/forum/#!topic/std-<wbr>p=
roposals/Gb3CFKiGLfo</a>) and in my recent proposal p0801 (<a href=3D"http:=
//www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0801r0.pdf" target=3D"_=
blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'http://www.google.c=
om/url?q\x3dhttp%3A%2F%2Fwww.open-std.org%2Fjtc1%2Fsc22%2Fwg21%2Fdocs%2Fpap=
ers%2F2017%2Fp0801r0.pdf\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHUBA6lny0O=
m6vqELlmXbyHKDdCdQ';return true;" onclick=3D"this.href=3D'http://ww=
w.google.com/url?q\x3dhttp%3A%2F%2Fwww.open-std.org%2Fjtc1%2Fsc22%2Fwg21%2F=
docs%2Fpapers%2F2017%2Fp0801r0.pdf\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCN=
HUBA6lny0Om6vqELlmXbyHKDdCdQ';return true;">http://www.open-std.org/jtc=
1/<wbr>sc22/wg21/docs/papers/2017/<wbr>p0801r0.pdf</a>).</div><div><br></di=
v><div>What do you think of my solution? I am looking forward to your comme=
nts and suggestions.<br></div><div><br></div><div>Mingxin Wang</div></div><=
/blockquote></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/be6246f6-c7f4-4b58-81b4-6eaa1e59af55%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/be6246f6-c7f4-4b58-81b4-6eaa1e59af55=
%40isocpp.org</a>.<br />
------=_Part_1840_70241395.1513240262865--
------=_Part_1839_1523883449.1513240262865--
.
Author: Mingxin Wang <wmx16835vv@163.com>
Date: Thu, 14 Dec 2017 02:24:41 -0800 (PST)
Raw View
------=_Part_2154_95795803.1513247081429
Content-Type: multipart/alternative;
boundary="----=_Part_2155_1036767481.1513247081430"
------=_Part_2155_1036767481.1513247081430
Content-Type: text/plain; charset="UTF-8"
On Thursday, December 14, 2017 at 4:31:03 PM UTC+8, bastie...@gmail.com
wrote:
>
> I'm sorry but more of the same is not going to help here.
> A library solution doesn't help.
> std::integral_constant & affiliated solutions are generally extremely
> clunky and require the user of to work for the solution to be functional.
>
If it is required to specify various types of metadata to a class template,
there seems to be no necessity to use other utilities, e.g.:
template <class ENUM_T, ENUM_T E>
class foo {
// ...
};
I actually disagree on your statement that's it's not possible.
>
I did not seem to say something "not possible" in my statement. What do you
mean by the "it"?
> The only issue with it is C++ parsing and there is a simple solution.
> I proposed it in an earlier thread, that said "universal template
> parameter" ought to behave as dependent members:
> -implicitly value.
> -requires prefix "typename" if used, or tried to be used, as type.
> -requires prefix "template" if is a template template parameter.
>
That will be a new language feature. However, the motivation of it seems to
be insufficient, because:
1. The idea will carry unnecessary ambiguation to the semantics of the
template, and further reduce the maintainability of the product.
2. I could not find a case that your idea could give full play to the
advantages.
> With the difference that when giving such an argument to a template
> instantiation list the value/type must be substituted for the parsed one.
>
> Ex:
> template<template T>
> constexpr auto func()
> {
> if constexpr (requires() { T; })
> return T;
> else if constexpr (requires() { typename T; })
> return typename T{};
> else
> return template T<>{};
> }
>
> template<template T>
> constexpr void x()
> {
> func<T>(); //is pre-parsed as a dependent template argument. T is then
> substituted on instantiation by its actual value.
> }
>
> int main(){
> x<42>(); //ok
> x<int>(); //ok
> }
>
> Having seen from close GCC implementation I believe it's technically
> doable.
>
I think this case properly illustrates the syntax you designed, but could
not prove the reasonableness of your idea, because there seems to be little
motivation for a user to design the function template `func` defined above,
and thus this case seems to be meaningless.
> On the syntax front I disagree on the use of "using" and the justification
> behind it.
> "using" has one meaning : name substitution. With namespaces, classes and
> functions. NOT values.
> "template" is actually more appropriate.
> Template only means canvas, to be substituted by.
> You can template any kind of definition.
> Using "template" as a universal template argument seems more intuitive
> than "using".
> "template" in a template parameter list would simply mean:
> a parameter-less template, something to be resolved as template doesn't
> infer what is actually templated.
>
From my point of view, the template is a container of metadata, and "type"
is a the basic type of metadata because any "value metadata" has a type,
and that "type" is also a part of metadata. Thus, I think, the type of the
"value metadata" should not be ignored in a template.
> On Thursday, December 14, 2017 at 4:09:41 AM UTC+1, Mingxin Wang wrote:
>>
>> On Thursday, December 14, 2017 at 4:45:07 AM UTC+8, adrian....@gmail.com
>> wrote:
>>>
>>> Some time ago I participate in discussion of similar feature. One
>>>> difference was that was using `using` keyword to introduce unknown type of
>>>> template parameters. I think use in this context will be consisting with
>>>> rest of language because you can `using` not only types but function too.
>>>>
>>>
>>> Well, I think using is better keyword to use than the bare template keyword
>>> IMHO. When I see template, I just expect to see a template there, not
>>> any TPT. Other alternatives I considered were auto, as it would
>>> automatically match any TPT, but that is currently in use now, and *
>>> (asterix), which is like a glob that matches everything. The use of no
>>> keyword was a fairly obvious mnemonic, I didn't specify what TPT, so allow
>>> any TPT.
>>>
>>> Quite honestly, I don't really mind any of these alternatives, but I
>>> think that we should not be limited like we are now. This feature is a
>>> long time coming and should be added to the language.
>>>
>>> What other differences were there in the other discussion you had? What
>>> reason was given to blockade this type of feature?
>>>
>>
>> I think "allowing any parameter in a template" is a common demand,
>> especially in compile-time programming.
>>
>> With the standard we have now, one is always required to specify the
>> types of the parameters declared in a template. In order to define the
>> semantics of the template explicitly, the class template
>> `std::integral_constant` was introduced, so that users are able to pass any
>> integral constants with the template. However, I think `integral_constant`
>> is inappropriately named, and there seem to be little necessity in defining
>> any member types or constants in it, because these metadata is already
>> passed by templates.
>>
>> In order to standardize the expressions to pass various sort of metadata
>> to templates, the class templates `in_place_arg_t` and
>> `in_place_resource_t` were proposed in one of my earlier posts (
>> https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/Gb3CFKiGLfo)
>> and in my recent proposal p0801 (
>> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0801r0.pdf).
>>
>> What do you think of my solution? I am looking forward to your comments
>> and suggestions.
>>
>> Mingxin Wang
>>
>
--
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/18dbf7a3-7d0b-47ea-8012-90cf687b1d5d%40isocpp.org.
------=_Part_2155_1036767481.1513247081430
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Thursday, December 14, 2017 at 4:31:03 PM UTC+8, bastie=
....@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;ma=
rgin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr">I'm sorry but more of the same is not going to help here.<div>=
A library solution doesn't help.</div><div>std::integral_constant &=
affiliated solutions are generally extremely clunky and require the user o=
f to work for the solution to be functional.</div></div></blockquote><div><=
br></div><div>If it is required to specify various types of metadata to a c=
lass template, there seems to be no necessity to use other utilities, e.g.:=
<br></div><div><br></div><div><div>template <class ENUM_T, ENUM_T E><=
/div><div>class foo {</div><div>=C2=A0 // ...</div><div>};</div></div><div>=
<br></div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left:=
0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><di=
v></div><div>I actually disagree on your statement that's it's not =
possible.</div></div></blockquote><div><br></div><div>I did not seem to say=
something "not possible" in my statement. What do you mean by th=
e "it"?</div><div>=C2=A0</div><blockquote class=3D"gmail_quote" s=
tyle=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-le=
ft: 1ex;"><div dir=3D"ltr"><div>The only issue with it is C++ parsing and t=
here is a simple solution.</div><div>I proposed it in an earlier thread, th=
at said "universal template parameter" ought to behave as depende=
nt members:</div><div>-implicitly value.<br></div><div>-requires prefix &qu=
ot;typename" if used, or tried to be used, as type.</div><div>-require=
s prefix "template" if is a template template parameter.</div></d=
iv></blockquote><div><br></div><div>That will be a new language feature. Ho=
wever, the motivation of it seems to be insufficient, because:</div><div>1.=
The idea will carry unnecessary ambiguation to the semantics of the templa=
te, and further=C2=A0reduce the maintainability of the product.</div><div>2=
.. I could not find a case that your idea could give full play to the advant=
ages.</div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"marg=
in: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><d=
iv dir=3D"ltr"><div></div><div>With the difference that when giving such an=
argument to a template instantiation list the value/type must be substitut=
ed for the parsed one.</div><div><br></div><div>Ex:</div><div style=3D"back=
ground-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:so=
lid;border-width:1px;word-wrap:break-word"><code><div><span style=3D"color:=
#008">template</span><span style=3D"color:#660"><</span><span style=3D"c=
olor:#008">template</span><span style=3D"color:#000"> T</span><span style=
=3D"color:#660">></span><span style=3D"color:#000"><br></span><span styl=
e=3D"color:#008">constexpr</span><span style=3D"color:#000"> </span><span s=
tyle=3D"color:#008">auto</span><span style=3D"color:#000"> =C2=A0func</span=
><span style=3D"color:#660">()</span><span style=3D"color:#000"><br></span>=
<span style=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 </span><span style=3D"color:#008">if</span><span style=3D"color:#000=
"> </span><span style=3D"color:#008">constexpr</span><span style=3D"color:#=
000"> </span><span style=3D"color:#660">(</span><span style=3D"color:#000">=
requires</span><span style=3D"color:#660">()</span><span style=3D"color:#00=
0"> </span><span style=3D"color:#660">{</span><span style=3D"color:#000"> T=
</span><span style=3D"color:#660">;</span><span style=3D"color:#000"> </spa=
n><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:#008">return</span><span =
style=3D"color:#000"> T</span><span style=3D"color:#660">;</span><span styl=
e=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">else</=
span><span style=3D"color:#000"> </span><span style=3D"color:#008">if</span=
><span style=3D"color:#000"> </span><span style=3D"color:#008">constexpr</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#660">(</span><=
span style=3D"color:#000">requires</span><span style=3D"color:#660">()</spa=
n><span style=3D"color:#000"> </span><span style=3D"color:#660">{</span><sp=
an style=3D"color:#000"> </span><span style=3D"color:#008">typename</span><=
span style=3D"color:#000"> T</span><span style=3D"color:#660">;</span><span=
style=3D"color:#000"> </span><span style=3D"color:#660">})</span><span sty=
le=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"col=
or:#008">return</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#008">typename</span><span style=3D"color:#000"> T</span><span style=3D"=
color:#660">{};</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><=
span style=3D"color:#008">else</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">return</span><span s=
tyle=3D"color:#000"> </span><span style=3D"color:#008">template</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><=
span style=3D"color:#000"><br><br></span><span style=3D"color:#008">templat=
e</span><span style=3D"color:#660"><</span><span style=3D"color:#008">te=
mplate</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:#008=
">constexpr</span><span style=3D"color:#000"> </span><span style=3D"color:#=
008">void</span><span style=3D"color:#000"> x</span><span style=3D"color:#6=
60">()</span><span style=3D"color:#000"><br></span><span style=3D"color:#66=
0">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0func</span><span sty=
le=3D"color:#660"><</span><span style=3D"color:#000">T</span><span style=
=3D"color:#660">>();</span><span style=3D"color:#000"> </span><span styl=
e=3D"color:#800">//is pre-parsed as a dependent template argument. T is the=
n substituted on instantiation by its actual value.</span><span style=3D"co=
lor:#000"><br></span><span style=3D"color:#660">}</span><span style=3D"colo=
r:#000"><br><br></span><span style=3D"color:#008">int</span><span style=3D"=
color:#000"> main</span><span style=3D"color:#660">(){</span><span style=3D=
"color:#000"><br>=C2=A0 =C2=A0x</span><span style=3D"color:#660"><</span=
><span style=3D"color:#066">42</span><span style=3D"color:#660">>();</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#800">//ok</span=
><span style=3D"color:#000"><br>=C2=A0 =C2=A0x</span><span style=3D"color:#=
080"><int></span><span style=3D"color:#660">();</span><span style=3D"=
color:#000"> </span><span style=3D"color:#800">//ok</span><span style=3D"co=
lor:#000"><br></span><span style=3D"color:#660">}</span></div></code></div>=
<div><br></div><div>Having seen from close GCC implementation I believe it&=
#39;s technically doable.</div></div></blockquote><div><br></div><div>I thi=
nk this case properly illustrates the syntax you designed, but could not pr=
ove the reasonableness of your idea, because there seems to be little motiv=
ation for a user to design the function template `func` defined above, and =
thus this case seems to be=C2=A0meaningless.</div><div>=C2=A0</div><blockqu=
ote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left=
: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div></div><div>On th=
e syntax front I disagree on the use of "using" and the justifica=
tion behind it.</div><div>"using" has one meaning : name substitu=
tion. With namespaces, classes and functions. NOT values.</div><div>"t=
emplate" is actually more appropriate.</div><div>Template only means c=
anvas, to be substituted by.</div><div>You can template any kind of definit=
ion.</div><div>Using "template" as a universal template argument =
seems more intuitive than "using".</div><div>"template"=
in a template parameter list would simply mean:</div><div>a parameter-less=
template, something to be resolved as template doesn't infer what is a=
ctually templated.</div></div></blockquote><div><br></div><div>From my poin=
t of view, the template is a container of metadata, and "type" is=
a the basic type of metadata because any "value metadata" has a =
type, and that "type" is also a part of metadata. Thus, I think, =
the type of the "value metadata" should not be ignored in a templ=
ate.</div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margi=
n: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><di=
v dir=3D"ltr"><div>On Thursday, December 14, 2017 at 4:09:41 AM UTC+1, Ming=
xin Wang wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-l=
eft:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">On =
Thursday, December 14, 2017 at 4:45:07 AM UTC+8, <a>adrian....@gmail.com</a=
> wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8=
ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><blockquot=
e class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px=
#ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>Some time ago I partici=
pate in discussion of similar feature. One difference was that was using `u=
sing` keyword to introduce unknown type of template parameters. I think use=
in this context will be consisting with rest of language because you can `=
using` not only types but function too.<br></div></div></blockquote><div><b=
r></div><div>Well, I think <font face=3D"courier new, monospace">using </fo=
nt>is better keyword to use than the bare <font face=3D"courier new, monosp=
ace">template </font>keyword IMHO.=C2=A0 =C2=A0When I see <font face=3D"cou=
rier new, monospace">template</font>, I just expect to see a template there=
, not any TPT.=C2=A0 Other alternatives I considered were <font face=3D"cou=
rier new, monospace">auto</font>, as it would automatically match any TPT, =
but that is currently in use now, and <font face=3D"courier new, monospace"=
>*</font><font face=3D"arial, sans-serif"> (asterix)</font>, which is like =
a glob that matches everything.=C2=A0 The use of no keyword was a fairly ob=
vious mnemonic, I didn't specify what TPT, so allow any TPT.</div><div>=
<br></div><div>Quite honestly, I don't really mind any of these alterna=
tives, but I think that we should not be limited like we are now.=C2=A0 Thi=
s feature is a long time coming and should be added to the language.</div><=
div><br></div><div>What other differences were there in the other discussio=
n you had?=C2=A0 What reason was given to blockade this type of feature?</d=
iv></div></blockquote><div><br></div><div>I think "allowing any parame=
ter in a template" is a common demand, especially in compile-time prog=
ramming.</div><div><br></div><div>With the standard we have now, one is alw=
ays required to specify the types of the parameters declared in a template.=
In order to define the semantics of the template explicitly, the class tem=
plate `std::integral_constant` was introduced, so that users are able to pa=
ss any integral constants with the template.=C2=A0However, I think `integra=
l_constant` is inappropriately named, and there seem to be little necessity=
in defining any member types or constants in it, because these metadata is=
already passed by templates.</div><div><br></div><div>In order to standard=
ize the expressions to pass various sort of metadata to templates, the clas=
s templates `in_place_arg_t` and `in_place_resource_t` were proposed in one=
of my earlier posts (<a href=3D"https://groups.google.com/a/isocpp.org/for=
um/#!topic/std-proposals/Gb3CFKiGLfo" rel=3D"nofollow" target=3D"_blank" on=
mousedown=3D"this.href=3D'https://groups.google.com/a/isocpp.org/forum/=
#!topic/std-proposals/Gb3CFKiGLfo';return true;" onclick=3D"this.href=
=3D'https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/=
Gb3CFKiGLfo';return true;">https://groups.google.com/a/<wbr>isocpp.org/=
forum/#!topic/std-<wbr>proposals/Gb3CFKiGLfo</a>) and in my recent proposal=
p0801 (<a href=3D"http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/=
p0801r0.pdf" rel=3D"nofollow" target=3D"_blank" onmousedown=3D"this.href=3D=
'http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.open-std.org%2Fjtc1%2F=
sc22%2Fwg21%2Fdocs%2Fpapers%2F2017%2Fp0801r0.pdf\x26sa\x3dD\x26sntz\x3d1\x2=
6usg\x3dAFQjCNHUBA6lny0Om6vqELlmXbyHKDdCdQ';return true;" onclick=3D"th=
is.href=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.open-std.org=
%2Fjtc1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2017%2Fp0801r0.pdf\x26sa\x3dD\x26sn=
tz\x3d1\x26usg\x3dAFQjCNHUBA6lny0Om6vqELlmXbyHKDdCdQ';return true;">htt=
p://www.open-std.org/jtc1/<wbr>sc22/wg21/docs/papers/2017/<wbr>p0801r0.pdf<=
/a>).</div><div><br></div><div>What do you think of my solution? I am looki=
ng forward to your comments and suggestions.<br></div><div><br></div><div>M=
ingxin Wang</div></div></blockquote></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" 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/18dbf7a3-7d0b-47ea-8012-90cf687b1d5d%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/18dbf7a3-7d0b-47ea-8012-90cf687b1d5d=
%40isocpp.org</a>.<br />
------=_Part_2155_1036767481.1513247081430--
------=_Part_2154_95795803.1513247081429--
.
Author: bastienpenava@gmail.com
Date: Thu, 14 Dec 2017 06:25:24 -0800 (PST)
Raw View
------=_Part_2669_220160748.1513261524708
Content-Type: multipart/alternative;
boundary="----=_Part_2670_452756807.1513261524709"
------=_Part_2670_452756807.1513261524709
Content-Type: text/plain; charset="UTF-8"
On Thursday, December 14, 2017 at 11:24:41 AM UTC+1, Mingxin Wang wrote:
>
> On Thursday, December 14, 2017 at 4:31:03 PM UTC+8, bastie...@gmail.com
> wrote:
>>
>> I'm sorry but more of the same is not going to help here.
>> A library solution doesn't help.
>> std::integral_constant & affiliated solutions are generally extremely
>> clunky and require the user of to work for the solution to be functional.
>>
>
> If it is required to specify various types of metadata to a class
> template, there seems to be no necessity to use other utilities, e.g.:
>
> template <class ENUM_T, ENUM_T E>
> class foo {
> // ...
> };
>
My point was that std::integral_constant is a hack and we don't need more
hack on the user-side.
> I actually disagree on your statement that's it's not possible.
>>
>
> I did not seem to say something "not possible" in my statement. What do
> you mean by the "it"?
>
"With the standard we have now, one is always required to specify the types
of the parameters declared in a template."
>
>
>> The only issue with it is C++ parsing and there is a simple solution.
>> I proposed it in an earlier thread, that said "universal template
>> parameter" ought to behave as dependent members:
>> -implicitly value.
>> -requires prefix "typename" if used, or tried to be used, as type.
>> -requires prefix "template" if is a template template parameter.
>>
>
> That will be a new language feature. However, the motivation of it seems
> to be insufficient, because:
> 1. The idea will carry unnecessary ambiguation to the semantics of the
> template, and further reduce the maintainability of the product.
>
I don't see where you see ambiguation.
"template" in a template argument list is not possible now and would only
impact the parsing of template template parameters.
As for reducing the maintainability that's false and unjustified.
2. I could not find a case that your idea could give full play to the
> advantages.
>
I can give you one that's would be simple to use and useful : named_tuple.
named_tuple<int, "age", string, "name"> x;
x.get<"name">() = get_user_name();
static_assert(std::is_same_v<std::string &, decltype(std::get<1>())>);
>
>> With the difference that when giving such an argument to a template
>> instantiation list the value/type must be substituted for the parsed one.
>>
>> Ex:
>> template<template T>
>> constexpr auto func()
>> {
>> if constexpr (requires() { T; })
>> return T;
>> else if constexpr (requires() { typename T; })
>> return typename T{};
>> else
>> return template T<>{};
>> }
>>
>> template<template T>
>> constexpr void x()
>> {
>> func<T>(); //is pre-parsed as a dependent template argument. T is
>> then substituted on instantiation by its actual value.
>> }
>>
>> int main(){
>> x<42>(); //ok
>> x<int>(); //ok
>> }
>>
>> Having seen from close GCC implementation I believe it's technically
>> doable.
>>
>
> I think this case properly illustrates the syntax you designed, but could
> not prove the reasonableness of your idea, because there seems to be little
> motivation for a user to design the function template `func` defined above,
> and thus this case seems to be meaningless.
>
Are you arguing that a demonstration is not an use-case? That's weak.
On the reasonableness of the idea, you, yourself, said that it was a
popular request and would be useful for metaprogramming purpose.
>
>
>> On the syntax front I disagree on the use of "using" and the
>> justification behind it.
>> "using" has one meaning : name substitution. With namespaces, classes and
>> functions. NOT values.
>> "template" is actually more appropriate.
>> Template only means canvas, to be substituted by.
>> You can template any kind of definition.
>> Using "template" as a universal template argument seems more intuitive
>> than "using".
>> "template" in a template parameter list would simply mean:
>> a parameter-less template, something to be resolved as template doesn't
>> infer what is actually templated.
>>
>
> From my point of view, the template is a container of metadata, and "type"
> is a the basic type of metadata because any "value metadata" has a type,
> and that "type" is also a part of metadata. Thus, I think, the type of the
> "value metadata" should not be ignored in a template.
>
No. Metadata is data about data, it's a state that describe a state.
A template is declarative. It's a parameterized definition nothing else.
Regardless because we are talking about the keyword template inside a
template parameter list.
I chose template because it doesn't require a new keyword and a template
can be used to parameterize any type of definition (type, variable,
function, using, etc...).
Here the logical reasoning as to why template.
If we take a template template parameter : template<class> class T.
template<class> class T means a type named T parameterized over a type.
template class T would be the same thing as class T, a type named T
parameterized over nothing, pointless so not implemented.
template T is something parameterized over nothing, in other words:
something.
It's quite similar to the transformation that occurred with auto from C to
C++.
auto int x, in C++98 && C auto was useless here as it was the default
storage of a local variable.
auto x, since C++11 this means variable of automatic type and now auto int x
is no longer legal.
>
>> On Thursday, December 14, 2017 at 4:09:41 AM UTC+1, Mingxin Wang wrote:
>>>
>>> On Thursday, December 14, 2017 at 4:45:07 AM UTC+8, adrian....@gmail.com
>>> wrote:
>>>>
>>>> Some time ago I participate in discussion of similar feature. One
>>>>> difference was that was using `using` keyword to introduce unknown type of
>>>>> template parameters. I think use in this context will be consisting with
>>>>> rest of language because you can `using` not only types but function too.
>>>>>
>>>>
>>>> Well, I think using is better keyword to use than the bare template keyword
>>>> IMHO. When I see template, I just expect to see a template there,
>>>> not any TPT. Other alternatives I considered were auto, as it would
>>>> automatically match any TPT, but that is currently in use now, and *
>>>> (asterix), which is like a glob that matches everything. The use of
>>>> no keyword was a fairly obvious mnemonic, I didn't specify what TPT, so
>>>> allow any TPT.
>>>>
>>>> Quite honestly, I don't really mind any of these alternatives, but I
>>>> think that we should not be limited like we are now. This feature is a
>>>> long time coming and should be added to the language.
>>>>
>>>> What other differences were there in the other discussion you had?
>>>> What reason was given to blockade this type of feature?
>>>>
>>>
>>> I think "allowing any parameter in a template" is a common demand,
>>> especially in compile-time programming.
>>>
>>> With the standard we have now, one is always required to specify the
>>> types of the parameters declared in a template. In order to define the
>>> semantics of the template explicitly, the class template
>>> `std::integral_constant` was introduced, so that users are able to pass any
>>> integral constants with the template. However, I think `integral_constant`
>>> is inappropriately named, and there seem to be little necessity in defining
>>> any member types or constants in it, because these metadata is already
>>> passed by templates.
>>>
>>> In order to standardize the expressions to pass various sort of metadata
>>> to templates, the class templates `in_place_arg_t` and
>>> `in_place_resource_t` were proposed in one of my earlier posts (
>>> https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/Gb3CFKiGLfo)
>>> and in my recent proposal p0801 (
>>> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0801r0.pdf).
>>>
>>> What do you think of my solution? I am looking forward to your comments
>>> and suggestions.
>>>
>>> Mingxin Wang
>>>
>>
--
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/22c70ebe-9558-4322-aea7-74b977eecf5b%40isocpp.org.
------=_Part_2670_452756807.1513261524709
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Thursday, December 14, 2017 at 11:24:41 AM UTC+=
1, Mingxin Wang wrote:<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 Thursday, December 14, 2017 at 4:31:03 PM UTC+8, <a>bastie...@g=
mail.com</a> wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;marg=
in-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"=
>I'm sorry but more of the same is not going to help here.<div>A librar=
y solution doesn't help.</div><div>std::integral_constant & affilia=
ted solutions are generally extremely clunky and require the user of to wor=
k for the solution to be functional.</div></div></blockquote><div><br></div=
><div>If it is required to specify various types of metadata to a class tem=
plate, there seems to be no necessity to use other utilities, e.g.:<br></di=
v><div><br></div><div><div>template <class ENUM_T, ENUM_T E></div><di=
v>class foo {</div><div>=C2=A0 // ...</div><div>};=C2=A0</div></div></div><=
/blockquote><div><br></div><div>My point was that std::integral_constant is=
a hack and we don't need more hack on the user-side.</div><div><br></d=
iv><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"><div><br><=
/div><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"><div></div><d=
iv>I actually disagree on your statement that's it's not possible.<=
/div></div></blockquote><div><br></div><div>I did not seem to say something=
"not possible" in my statement. What do you mean by the "it=
"?</div><div></div></div></blockquote><div><br></div><div>"With t=
he standard we have now, one is always required to specify the types of the=
parameters declared in a template."</div><div>=C2=A0</div><blockquote=
class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1=
px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div>=C2=A0</div><blockq=
uote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:=
1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>The only issue with =
it is C++ parsing and there is a simple solution.</div><div>I proposed it i=
n an earlier thread, that said "universal template parameter" oug=
ht to behave as dependent members:</div><div>-implicitly value.<br></div><d=
iv>-requires prefix "typename" if used, or tried to be used, as t=
ype.</div><div>-requires prefix "template" if is a template templ=
ate parameter.</div></div></blockquote><div><br></div><div>That will be a n=
ew language feature. However, the motivation of it seems to be insufficient=
, because:</div><div>1. The idea will carry unnecessary ambiguation to the =
semantics of the template, and further=C2=A0reduce the maintainability of t=
he product.</div></div></blockquote><div>I don't see where you see ambi=
guation.<br></div><div>"template" in a template argument list is =
not possible now and would only impact the parsing of template template par=
ameters.</div><div>As for reducing=C2=A0 the maintainability=C2=A0that'=
s false and unjustified.</div><div><br></div><blockquote class=3D"gmail_quo=
te" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;paddi=
ng-left: 1ex;"><div dir=3D"ltr"><div>2. I could not find a case that your i=
dea could give full play to the advantages.</div></div></blockquote><div>=
=C2=A0I can give you one that's would be simple to use and useful : nam=
ed_tuple.</div><div><br></div><div class=3D"prettyprint" style=3D"backgroun=
d-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style=
: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"prettypr=
int"><div class=3D"subprettyprint"><span style=3D"color: #000;" class=3D"st=
yled-by-prettify">named_tuple</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify"><</span><span style=3D"color: #008;" class=3D"styled-=
by-prettify">int</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">"age&qu=
ot;</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">string</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">"name"</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">></span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> x</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br>x</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">.</span><span style=3D"color: #008;" class=3D"styled-by-prettify">ge=
t</span><span style=3D"color: #660;" class=3D"styled-by-prettify"><</spa=
n><span style=3D"color: #080;" class=3D"styled-by-prettify">"name"=
;</span><span style=3D"color: #660;" class=3D"styled-by-prettify">>()</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> get_user_name</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">();</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">static_assert</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify">std</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify">is_same_v</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify"><</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">std</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">::</span><span style=3D"color: #008;" class=3D"styled-by-prettify">strin=
g</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: #008;" class=3D"styled-by-prettify">decltype</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">std</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">::</span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">get</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify"><</span><span style=3D"color: #066;" class=3D"styled-by-prett=
ify">1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">>=
())>);</span></div></code></div><div><br></div><blockquote class=3D"gmai=
l_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;=
padding-left: 1ex;"><div dir=3D"ltr"><div>=C2=A0</div><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"><div></div><div>With the difference tha=
t when giving such an argument to a template instantiation list the value/t=
ype must be substituted for the parsed one.</div><div><br></div><div>Ex:</d=
iv><div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187=
,187);border-style:solid;border-width:1px;word-wrap:break-word"><code><div>=
<span style=3D"color:#008">template</span><span style=3D"color:#660"><</=
span><span style=3D"color:#008">template</span><span style=3D"color:#000"> =
T</span><span style=3D"color:#660">></span><span style=3D"color:#000"><b=
r></span><span style=3D"color:#008">constexpr</span><span style=3D"color:#0=
00"> </span><span style=3D"color:#008">auto</span><span style=3D"color:#000=
"> =C2=A0func</span><span style=3D"color:#660">()</span><span style=3D"colo=
r:#000"><br></span><span style=3D"color:#660">{</span><span style=3D"color:=
#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">if</span><span st=
yle=3D"color:#000"> </span><span style=3D"color:#008">constexpr</span><span=
style=3D"color:#000"> </span><span style=3D"color:#660">(</span><span styl=
e=3D"color:#000">requires</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"> T</span><span style=3D"color:#660">;</span><span style=3D"=
color:#000"> </span><span style=3D"color:#660">})</span><span style=3D"colo=
r:#000"><br>=C2=A0 =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>=C2=A0 =C2=A0 </span><span style=3D"=
color:#008">else</span><span style=3D"color:#000"> </span><span style=3D"co=
lor:#008">if</span><span style=3D"color:#000"> </span><span style=3D"color:=
#008">constexpr</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#660">(</span><span style=3D"color:#000">requires</span><span style=3D"c=
olor:#660">()</span><span style=3D"color:#000"> </span><span style=3D"color=
:#660">{</span><span style=3D"color:#000"> </span><span style=3D"color:#008=
">typename</span><span style=3D"color:#000"> T</span><span style=3D"color:#=
660">;</span><span style=3D"color:#000"> </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:#008">return</span><span style=3D"color:#000"> </span>=
<span style=3D"color:#008">typename</span><span style=3D"color:#000"> T</sp=
an><span style=3D"color:#660">{};</span><span style=3D"color:#000"><br>=C2=
=A0 =C2=A0 </span><span style=3D"color:#008">else</span><span style=3D"colo=
r:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#008">r=
eturn</span><span style=3D"color:#000"> </span><span style=3D"color:#008">t=
emplate</span><span style=3D"color:#000"> T</span><span style=3D"color:#660=
"><>{};</span><span style=3D"color:#000"><br></span><span style=3D"co=
lor:#660">}</span><span style=3D"color:#000"><br><br></span><span style=3D"=
color:#008">template</span><span style=3D"color:#660"><</span><span styl=
e=3D"color:#008">template</span><span style=3D"color:#000"> T</span><span s=
tyle=3D"color:#660">></span><span style=3D"color:#000"><br></span><span =
style=3D"color:#008">constexpr</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#008">void</span><span style=3D"color:#000"> x</span><spa=
n 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=A0f=
unc</span><span style=3D"color:#660"><</span><span style=3D"color:#000">=
T</span><span style=3D"color:#660">>();</span><span style=3D"color:#000"=
> </span><span style=3D"color:#800">//is pre-parsed as a dependent template=
argument. T is then substituted on instantiation by its actual value.</spa=
n><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">int</s=
pan><span style=3D"color:#000"> main</span><span style=3D"color:#660">(){</=
span><span style=3D"color:#000"><br>=C2=A0 =C2=A0x</span><span style=3D"col=
or:#660"><</span><span style=3D"color:#066">42</span><span style=3D"colo=
r:#660">>();</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#800">//ok</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0x</span><sp=
an style=3D"color:#080"><int></span><span style=3D"color:#660">();</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#800">//ok</spa=
n><span style=3D"color:#000"><br></span><span style=3D"color:#660">}</span>=
</div></code></div><div><br></div><div>Having seen from close GCC implement=
ation I believe it's technically doable.</div></div></blockquote><div><=
br></div><div>I think this case properly illustrates the syntax you designe=
d, but could not prove the reasonableness of your idea, because there seems=
to be little motivation for a user to design the function template `func` =
defined above, and thus this case seems to be=C2=A0meaningless.</div></div>=
</blockquote><div>Are you arguing that a demonstration is not an use-case? =
That's weak.</div><div>On the reasonableness of the idea, you, yourself=
, said that it was a popular request and would be useful for metaprogrammin=
g purpose.</div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin=
-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"lt=
r"><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0;mar=
gin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr=
"><div></div><div>On the syntax front I disagree on the use of "using&=
quot; and the justification behind it.</div><div>"using" has one =
meaning : name substitution. With namespaces, classes and functions. NOT va=
lues.</div><div>"template" is actually more appropriate.</div><di=
v>Template only means canvas, to be substituted by.</div><div>You can templ=
ate any kind of definition.</div><div>Using "template" as a unive=
rsal template argument seems more intuitive than "using".</div><d=
iv>"template" in a template parameter list would simply mean:</di=
v><div>a parameter-less template, something to be resolved as template does=
n't infer what is actually templated.</div></div></blockquote><div><br>=
</div><div>From my point of view, the template is a container of metadata, =
and "type" is a the basic type of metadata because any "valu=
e metadata" has a type, and that "type" is also a part of me=
tadata. Thus, I think, the type of the "value metadata" should no=
t be ignored in a template.</div></div></blockquote><div>No. Metadata is da=
ta about data, it's a state that describe a state.</div><div>A template=
is declarative. It's a parameterized definition nothing else.</div><di=
v>Regardless because we are talking about the keyword template inside a tem=
plate parameter list.</div><div>I chose template because it doesn't req=
uire a new keyword and a template can be used to parameterize any type of d=
efinition (type, variable, function, using, etc...).</div><div>Here the log=
ical reasoning as to why template.<br></div><div><br></div><div>If we take =
a template template parameter :=C2=A0<span class=3D"styled-by-prettify" sty=
le=3D"font-family: monospace; background-color: rgb(250, 250, 250); color: =
rgb(0, 0, 136);">template</span><span class=3D"styled-by-prettify" style=3D=
"font-family: monospace; background-color: rgb(250, 250, 250); color: rgb(0=
, 136, 0);"><class></span><span class=3D"styled-by-prettify" style=3D=
"font-family: monospace; background-color: rgb(250, 250, 250); color: rgb(0=
, 0, 0);">=C2=A0</span><span class=3D"styled-by-prettify" style=3D"font-fam=
ily: monospace; background-color: rgb(250, 250, 250); color: rgb(0, 0, 136)=
;">class</span><span class=3D"styled-by-prettify" style=3D"font-family: mon=
ospace; background-color: rgb(250, 250, 250); color: rgb(0, 0, 0);">=C2=A0T=
</span>.</div><div><span class=3D"styled-by-prettify" style=3D"font-family:=
monospace; background-color: rgb(250, 250, 250); color: rgb(0, 0, 136);">t=
emplate</span><span class=3D"styled-by-prettify" style=3D"font-family: mono=
space; background-color: rgb(250, 250, 250); color: rgb(0, 136, 0);"><cl=
ass></span><span class=3D"styled-by-prettify" style=3D"font-family: mono=
space; background-color: rgb(250, 250, 250); color: rgb(0, 0, 0);">=C2=A0</=
span><span class=3D"styled-by-prettify" style=3D"font-family: monospace; ba=
ckground-color: rgb(250, 250, 250); color: rgb(0, 0, 136);">class</span><sp=
an class=3D"styled-by-prettify" style=3D"font-family: monospace; background=
-color: rgb(250, 250, 250); color: rgb(0, 0, 0);">=C2=A0T=C2=A0</span>means=
a type named T parameterized over a type.</div><div><span class=3D"styled-=
by-prettify" style=3D"font-family: monospace; background-color: rgb(250, 25=
0, 250); color: rgb(0, 0, 136);">template</span><span class=3D"styled-by-pr=
ettify" style=3D"font-family: monospace; background-color: rgb(250, 250, 25=
0); color: rgb(0, 0, 0);">=C2=A0</span><span class=3D"styled-by-prettify" s=
tyle=3D"font-family: monospace; background-color: rgb(250, 250, 250); color=
: rgb(0, 0, 136);">class</span><span class=3D"styled-by-prettify" style=3D"=
font-family: monospace; background-color: rgb(250, 250, 250); color: rgb(0,=
0, 0);">=C2=A0T=C2=A0</span>would be the same thing as=C2=A0<span class=3D=
"styled-by-prettify" style=3D"font-family: monospace; background-color: rgb=
(250, 250, 250); color: rgb(0, 0, 136);">class</span><span class=3D"styled-=
by-prettify" style=3D"font-family: monospace; background-color: rgb(250, 25=
0, 250); color: rgb(0, 0, 0);">=C2=A0T</span>, a type named T parameterized=
over nothing, pointless so not implemented.</div><div><span class=3D"style=
d-by-prettify" style=3D"color: rgb(0, 0, 136);">template</span><span class=
=3D"styled-by-prettify" style=3D"color: rgb(0, 0, 0);">=C2=A0T</span>=C2=A0=
is something parameterized over nothing, in other words: something.</div><d=
iv><br></div><div>It's quite similar to the transformation that occurre=
d with auto from C to C++.</div><div><span class=3D"styled-by-prettify" sty=
le=3D"font-family: monospace; background-color: rgb(250, 250, 250); color: =
rgb(0, 0, 136);">auto</span><span class=3D"styled-by-prettify" style=3D"fon=
t-family: monospace; background-color: rgb(250, 250, 250); color: rgb(0, 0,=
0);">=C2=A0</span><span class=3D"styled-by-prettify" style=3D"font-family:=
monospace; background-color: rgb(250, 250, 250); color: rgb(0, 0, 136);">i=
nt</span><span class=3D"styled-by-prettify" style=3D"font-family: monospace=
; background-color: rgb(250, 250, 250); color: rgb(0, 0, 0);">=C2=A0x, in C=
++98 && C auto was useless here as it was the default storage of a =
local variable.</span></div><div><span class=3D"styled-by-prettify" style=
=3D"font-family: monospace; background-color: rgb(250, 250, 250); color: rg=
b(0, 0, 136);">auto</span><span class=3D"styled-by-prettify" style=3D"font-=
family: monospace; background-color: rgb(250, 250, 250); color: rgb(0, 0, 0=
);">=C2=A0x, since C++11 this means variable of automatic type and now=C2=
=A0</span><span class=3D"styled-by-prettify" style=3D"font-family: monospac=
e; background-color: rgb(250, 250, 250); color: rgb(0, 0, 136);">auto</span=
><span class=3D"styled-by-prettify" style=3D"font-family: monospace; backgr=
ound-color: rgb(250, 250, 250); color: rgb(0, 0, 0);">=C2=A0</span><span cl=
ass=3D"styled-by-prettify" style=3D"font-family: monospace; background-colo=
r: rgb(250, 250, 250); color: rgb(0, 0, 136);">int</span><span class=3D"sty=
led-by-prettify" style=3D"font-family: monospace; background-color: rgb(250=
, 250, 250); color: rgb(0, 0, 0);">=C2=A0x is no longer legal.</span></div>=
<div><br></div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-=
left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr=
"><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0;marg=
in-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"=
><div>On Thursday, December 14, 2017 at 4:09:41 AM UTC+1, Mingxin Wang wrot=
e:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;bor=
der-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">On Thursday, Dec=
ember 14, 2017 at 4:45:07 AM UTC+8, <a>adrian....@gmail.com</a> wrote:<bloc=
kquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-lef=
t:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><blockquote class=3D"gm=
ail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;p=
adding-left:1ex"><div dir=3D"ltr"><div>Some time ago I participate in discu=
ssion of similar feature. One difference was that was using `using` keyword=
to introduce unknown type of template parameters. I think use in this cont=
ext will be consisting with rest of language because you can `using` not on=
ly types but function too.<br></div></div></blockquote><div><br></div><div>=
Well, I think <font face=3D"courier new, monospace">using </font>is better =
keyword to use than the bare <font face=3D"courier new, monospace">template=
</font>keyword IMHO.=C2=A0 =C2=A0When I see <font face=3D"courier new, mon=
ospace">template</font>, I just expect to see a template there, not any TPT=
..=C2=A0 Other alternatives I considered were <font face=3D"courier new, mon=
ospace">auto</font>, as it would automatically match any TPT, but that is c=
urrently in use now, and <font face=3D"courier new, monospace">*</font><fon=
t face=3D"arial, sans-serif"> (asterix)</font>, which is like a glob that m=
atches everything.=C2=A0 The use of no keyword was a fairly obvious mnemoni=
c, I didn't specify what TPT, so allow any TPT.</div><div><br></div><di=
v>Quite honestly, I don't really mind any of these alternatives, but I =
think that we should not be limited like we are now.=C2=A0 This feature is =
a long time coming and should be added to the language.</div><div><br></div=
><div>What other differences were there in the other discussion you had?=C2=
=A0 What reason was given to blockade this type of feature?</div></div></bl=
ockquote><div><br></div><div>I think "allowing any parameter in a temp=
late" is a common demand, especially in compile-time programming.</div=
><div><br></div><div>With the standard we have now, one is always required =
to specify the types of the parameters declared in a template. In order to =
define the semantics of the template explicitly, the class template `std::i=
ntegral_constant` was introduced, so that users are able to pass any integr=
al constants with the template.=C2=A0However, I think `integral_constant` i=
s inappropriately named, and there seem to be little necessity in defining =
any member types or constants in it, because these metadata is already pass=
ed by templates.</div><div><br></div><div>In order to standardize the expre=
ssions to pass various sort of metadata to templates, the class templates `=
in_place_arg_t` and `in_place_resource_t` were proposed in one of my earlie=
r posts (<a href=3D"https://groups.google.com/a/isocpp.org/forum/#!topic/st=
d-proposals/Gb3CFKiGLfo" rel=3D"nofollow" target=3D"_blank" onmousedown=3D"=
this.href=3D'https://groups.google.com/a/isocpp.org/forum/#!topic/std-p=
roposals/Gb3CFKiGLfo';return true;" onclick=3D"this.href=3D'https:/=
/groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/Gb3CFKiGLfo'=
;;return true;">https://groups.google.com/a/<wbr>isocpp.org/forum/#!topic/s=
td-<wbr>proposals/Gb3CFKiGLfo</a>) and in my recent proposal p0801 (<a href=
=3D"http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0801r0.pdf" re=
l=3D"nofollow" target=3D"_blank" onmousedown=3D"this.href=3D'http://www=
..google.com/url?q\x3dhttp%3A%2F%2Fwww.open-std.org%2Fjtc1%2Fsc22%2Fwg21%2Fd=
ocs%2Fpapers%2F2017%2Fp0801r0.pdf\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNH=
UBA6lny0Om6vqELlmXbyHKDdCdQ';return true;" onclick=3D"this.href=3D'=
http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.open-std.org%2Fjtc1%2Fsc22%=
2Fwg21%2Fdocs%2Fpapers%2F2017%2Fp0801r0.pdf\x26sa\x3dD\x26sntz\x3d1\x26usg\=
x3dAFQjCNHUBA6lny0Om6vqELlmXbyHKDdCdQ';return true;">http://www.open-st=
d.org/jtc1/<wbr>sc22/wg21/docs/papers/2017/<wbr>p0801r0.pdf</a>).</div><div=
><br></div><div>What do you think of my solution? I am looking forward to y=
our comments and suggestions.<br></div><div><br></div><div>Mingxin Wang</di=
v></div></blockquote></div></div></blockquote></div></blockquote></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/22c70ebe-9558-4322-aea7-74b977eecf5b%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/22c70ebe-9558-4322-aea7-74b977eecf5b=
%40isocpp.org</a>.<br />
------=_Part_2670_452756807.1513261524709--
------=_Part_2669_220160748.1513261524708--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Thu, 14 Dec 2017 08:06:57 -0800 (PST)
Raw View
------=_Part_3133_1253101455.1513267617615
Content-Type: multipart/alternative;
boundary="----=_Part_3134_1809895391.1513267617616"
------=_Part_3134_1809895391.1513267617616
Content-Type: text/plain; charset="UTF-8"
On Thursday, December 14, 2017 at 9:25:24 AM UTC-5, bastie...@gmail.com
wrote:
>
> On Thursday, December 14, 2017 at 11:24:41 AM UTC+1, Mingxin Wang wrote:
>>
>> On Thursday, December 14, 2017 at 4:31:03 PM UTC+8, bastie...@gmail.com
>> wrote
>>
> 2. I could not find a case that your idea could give full play to the
>> advantages.
>>
> I can give you one that's would be simple to use and useful : named_tuple.
>
> named_tuple<int, "age", string, "name"> x;
> x.get<"name">() = get_user_name();
> static_assert(std::is_same_v<std::string &, decltype(std::get<1>())>);
>
>
Which can be accomplished adequately enough in other ways (assuming we
allow strings in template parameters):
named_tuple<tag<"age", int>, tag<"name", string>>;
Indeed, I think this would be a much better solution. First, it allows you
to have named_tuples with unnamed elements (`named_tuple<int, tag<"name",
string>>`). Second, I think it makes it easier on the implementation side.
For example, if you want to write a metafunction that takes a
`named_tuple<...>` and generates a list of its types, you can do this:
template<typename T>
struct get_type_from_tag
{
using type = T;
};
template<const char *Str, typename T>
struct get_type_from_tag<tag<Str, T>
{
using type = T;
};
template<T>
using get_type_from_tag_t = typename get_type_from_tag<T>::type;
template<typename Tpl>
struct types_from_tuple {};
template<typename ...Ts>
struct types_from_tuple<named_tuple<Ts...>>
{
using type = type_list<get_type_from_tag_t<Ts>...>;
};
The metafunction for your code's equivalent would not be able to use
expansion like that. Since every pair of `T` in the argument list contains
the actual type, you would need to use recursion to extract the list of
`T`s. Not the hardest thing in the world, but hardly as straightforward as
this.
I think this case properly illustrates the syntax you designed, but could
>> not prove the reasonableness of your idea, because there seems to be little
>> motivation for a user to design the function template `func` defined above,
>> and thus this case seems to be meaningless.
>>
> Are you arguing that a demonstration is not an use-case? That's weak.
>
What is so "weak" about it? An artificial example that doesn't have
real-world utility is not an effective motivation for a feature. I admit
that I'm not a deep metaprogramming expert, so it is entirely possible I'm
missing something here. But thus far, I have not seen a genuinely
compelling use case that cannot adequately be solved with some other
mechanism.
--
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/65dd5a3b-990e-4916-b733-9f1a803691ae%40isocpp.org.
------=_Part_3134_1809895391.1513267617616
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Thursday, December 14, 2017 at 9:25:24 AM UTC-5, bastie=
....@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;ma=
rgin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr">On Thursday, December 14, 2017 at 11:24:41 AM UTC+1, Mingxin Wang =
wrote:<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 Thursday,=
December 14, 2017 at 4:31:03 PM UTC+8, <a>bastie...@gmail.com</a> wrote</d=
iv></blockquote></div></blockquote><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"><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">2. I could not find a case that your idea could give full play to the =
advantages.</div></blockquote></div></blockquote><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"><div>=C2=A0I can give you one that'=
s would be simple to use and useful : named_tuple.</div><div><br></div><div=
style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);b=
order-style:solid;border-width:1px;word-wrap:break-word"><code><div><span s=
tyle=3D"color:#000">named_tuple</span><span style=3D"color:#660"><</span=
><span style=3D"color:#008">int</span><span style=3D"color:#660">,</span><s=
pan style=3D"color:#000"> </span><span style=3D"color:#080">"age"=
</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#008">string</span><span style=3D"color:#660">,</spa=
n><span style=3D"color:#000"> </span><span style=3D"color:#080">"name&=
quot;</span><span style=3D"color:#660">></span><span style=3D"color:#000=
"> x</span><span style=3D"color:#660">;</span><span style=3D"color:#000"><b=
r>x</span><span style=3D"color:#660">.</span><span style=3D"color:#008">get=
</span><span style=3D"color:#660"><</span><span style=3D"color:#080">&qu=
ot;name"</span><span style=3D"color:#660">>()</span><span style=3D"=
color:#000"> </span><span style=3D"color:#660">=3D</span><span style=3D"col=
or:#000"> get_user_name</span><span style=3D"color:#660">();</span><span st=
yle=3D"color:#000"><br></span><span style=3D"color:#008">static_assert</spa=
n><span style=3D"color:#660">(</span><span style=3D"color:#000">std</span><=
span style=3D"color:#660">::</span><span style=3D"color:#000">is_same_v</sp=
an><span style=3D"color:#660"><</span><span style=3D"color:#000">s<wbr>t=
d</span><span style=3D"color:#660">::</span><span style=3D"color:#008">stri=
ng</span><span style=3D"color:#000"> </span><span style=3D"color:#660">&=
;,</span><span style=3D"color:#000"> </span><span style=3D"color:#008">decl=
type</span><span style=3D"color:#660">(</span><span style=3D"color:#000">st=
d</span><span style=3D"color:#660">::</span><span style=3D"color:#008">get<=
/span><span style=3D"color:#660"><</span><span style=3D"color:#066">1</s=
pan><span style=3D"color:#660">>())>);</span></div></code></div><div>=
<br></div></div></blockquote><div><br></div><div><div>Which can be accompli=
shed adequately enough in other ways (assuming we allow strings in template=
parameters):</div><div><br></div><div class=3D"prettyprint" style=3D"borde=
r: 1px solid rgb(187, 187, 187); word-wrap: break-word; background-color: r=
gb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subprettyprin=
t"><span class=3D"styled-by-prettify" style=3D"color: #000;">named_tuple</s=
pan><span class=3D"styled-by-prettify" style=3D"color: #660;"><</span><s=
pan class=3D"styled-by-prettify" style=3D"color: #000;">tag</span><span cla=
ss=3D"styled-by-prettify" style=3D"color: #660;"><</span><span class=3D"=
styled-by-prettify" style=3D"color: #080;">"age"</span><span clas=
s=3D"styled-by-prettify" style=3D"color: #660;">,</span><span class=3D"styl=
ed-by-prettify" style=3D"color: #000;"> </span><span class=3D"styled-by-pre=
ttify" style=3D"color: #008;">int</span><span class=3D"styled-by-prettify" =
style=3D"color: #660;">>,</span><span class=3D"styled-by-prettify" style=
=3D"color: #000;"> tag</span><span class=3D"styled-by-prettify" style=3D"co=
lor: #660;"><</span><span class=3D"styled-by-prettify" style=3D"color: #=
080;">"name"</span><span class=3D"styled-by-prettify" style=3D"co=
lor: #660;">,</span><span class=3D"styled-by-prettify" style=3D"color: #000=
;"> </span><span class=3D"styled-by-prettify" style=3D"color: #008;">string=
</span><span class=3D"styled-by-prettify" style=3D"color: #660;">>>;<=
/span></div></code></div><div><br></div><div>Indeed,
I think this would be a much better solution. First, it allows you to have=
named_tuples with unnamed elements (`named_tuple<int, tag<"name=
", string>>`). Second, I think it makes it easier on the impleme=
ntation=20
side. For example, if you=20
want to write a metafunction that takes a `named_tuple<...>`=20
and generates a list of its types, you can do this:</div><div><br></div><di=
v 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"pr=
ettyprint"><div class=3D"subprettyprint"><span class=3D"styled-by-prettify"=
style=3D"color: #008;">template</span><span class=3D"styled-by-prettify" s=
tyle=3D"color: #660;"><</span><span class=3D"styled-by-prettify" style=
=3D"color: #008;">typename</span><span class=3D"styled-by-prettify" style=
=3D"color: #000;"> T</span><span class=3D"styled-by-prettify" style=3D"colo=
r: #660;">></span><span class=3D"styled-by-prettify" style=3D"color: #00=
0;"><br></span><span class=3D"styled-by-prettify" style=3D"color: #008;">st=
ruct</span><span class=3D"styled-by-prettify" style=3D"color: #000;"> get_t=
ype_from_tag<br></span><span class=3D"styled-by-prettify" style=3D"color: #=
660;">{</span><span class=3D"styled-by-prettify" style=3D"color: #000;"><br=
>=C2=A0 </span><span class=3D"styled-by-prettify" style=3D"color: #008;">us=
ing</span><span class=3D"styled-by-prettify" style=3D"color: #000;"> type <=
/span><span class=3D"styled-by-prettify" style=3D"color: #660;">=3D</span><=
span class=3D"styled-by-prettify" style=3D"color: #000;"> T</span><span cla=
ss=3D"styled-by-prettify" style=3D"color: #660;">;</span><span class=3D"sty=
led-by-prettify" style=3D"color: #000;"><br></span><span class=3D"styled-by=
-prettify" style=3D"color: #660;">};</span><span class=3D"styled-by-prettif=
y" style=3D"color: #000;"><br><br></span><span class=3D"styled-by-prettify"=
style=3D"color: #008;">template</span><span class=3D"styled-by-prettify" s=
tyle=3D"color: #660;"><</span><span class=3D"styled-by-prettify" style=
=3D"color: #008;">const</span><span class=3D"styled-by-prettify" style=3D"c=
olor: #000;"> </span><span class=3D"styled-by-prettify" style=3D"color: #00=
8;">char</span><span class=3D"styled-by-prettify" style=3D"color: #000;"> <=
/span><span class=3D"styled-by-prettify" style=3D"color: #660;">*</span><sp=
an class=3D"styled-by-prettify" style=3D"color: #606;">Str</span><span clas=
s=3D"styled-by-prettify" style=3D"color: #660;">,</span><span class=3D"styl=
ed-by-prettify" style=3D"color: #000;"> </span><span class=3D"styled-by-pre=
ttify" style=3D"color: #008;">typename</span><span class=3D"styled-by-prett=
ify" style=3D"color: #000;"> T</span><span class=3D"styled-by-prettify" sty=
le=3D"color: #660;">></span><span class=3D"styled-by-prettify" style=3D"=
color: #000;"><br></span><span class=3D"styled-by-prettify" style=3D"color:=
#008;">struct</span><span class=3D"styled-by-prettify" style=3D"color: #00=
0;"> get_type_from_tag</span><span class=3D"styled-by-prettify" style=3D"co=
lor: #660;"><</span><span class=3D"styled-by-prettify" style=3D"color: #=
000;">tag</span><span class=3D"styled-by-prettify" style=3D"color: #660;">&=
lt;</span><span class=3D"styled-by-prettify" style=3D"color: #606;">Str</sp=
an><span class=3D"styled-by-prettify" style=3D"color: #660;">,</span><span =
class=3D"styled-by-prettify" style=3D"color: #000;"> T</span><span class=3D=
"styled-by-prettify" style=3D"color: #660;">></span><span class=3D"style=
d-by-prettify" style=3D"color: #000;"><br></span><span class=3D"styled-by-p=
rettify" style=3D"color: #660;">{</span><span class=3D"styled-by-prettify" =
style=3D"color: #000;"><br>=C2=A0 </span><span class=3D"styled-by-prettify"=
style=3D"color: #008;">using</span><span class=3D"styled-by-prettify" styl=
e=3D"color: #000;"> type </span><span class=3D"styled-by-prettify" style=3D=
"color: #660;">=3D</span><span class=3D"styled-by-prettify" style=3D"color:=
#000;"> T</span><span class=3D"styled-by-prettify" style=3D"color: #660;">=
;</span><span class=3D"styled-by-prettify" style=3D"color: #000;"><br></spa=
n><span class=3D"styled-by-prettify" style=3D"color: #660;">};</span><span =
class=3D"styled-by-prettify" style=3D"color: #000;"><br><br></span><span cl=
ass=3D"styled-by-prettify" style=3D"color: #008;">template</span><span clas=
s=3D"styled-by-prettify" style=3D"color: #660;"><</span><span class=3D"s=
tyled-by-prettify" style=3D"color: #000;">T</span><span class=3D"styled-by-=
prettify" style=3D"color: #660;">></span><span class=3D"styled-by-pretti=
fy" style=3D"color: #000;"><br></span><span class=3D"styled-by-prettify" st=
yle=3D"color: #008;">using</span><span class=3D"styled-by-prettify" style=
=3D"color: #000;"> get_type_from_tag_t </span><span class=3D"styled-by-pret=
tify" style=3D"color: #660;">=3D</span><span class=3D"styled-by-prettify" s=
tyle=3D"color: #000;"> </span><span class=3D"styled-by-prettify" style=3D"c=
olor: #008;">typename</span><span class=3D"styled-by-prettify" style=3D"col=
or: #000;"> get_type_from_tag</span><span class=3D"styled-by-prettify" styl=
e=3D"color: #660;"><</span><span class=3D"styled-by-prettify" style=3D"c=
olor: #000;">T</span><span class=3D"styled-by-prettify" style=3D"color: #66=
0;">>::</span><span class=3D"styled-by-prettify" style=3D"color: #000;">=
type</span><span class=3D"styled-by-prettify" style=3D"color: #660;">;</spa=
n><span class=3D"styled-by-prettify" style=3D"color: #000;"><br><br></span>=
<span class=3D"styled-by-prettify" style=3D"color: #008;">template</span><s=
pan class=3D"styled-by-prettify" style=3D"color: #660;"><</span><span cl=
ass=3D"styled-by-prettify" style=3D"color: #008;">typename</span><span clas=
s=3D"styled-by-prettify" style=3D"color: #000;"> </span><span class=3D"styl=
ed-by-prettify" style=3D"color: #606;">Tpl</span><span class=3D"styled-by-p=
rettify" style=3D"color: #660;">></span><span class=3D"styled-by-prettif=
y" style=3D"color: #000;"><br></span><span class=3D"styled-by-prettify" sty=
le=3D"color: #008;">struct</span><span class=3D"styled-by-prettify" style=
=3D"color: #000;"> types_from_tuple </span><span class=3D"styled-by-prettif=
y" style=3D"color: #660;">{};</span><span class=3D"styled-by-prettify" styl=
e=3D"color: #000;"><br><br></span><span class=3D"styled-by-prettify" style=
=3D"color: #008;">template</span><span class=3D"styled-by-prettify" style=
=3D"color: #660;"><</span><span class=3D"styled-by-prettify" style=3D"co=
lor: #008;">typename</span><span class=3D"styled-by-prettify" style=3D"colo=
r: #000;"> </span><span class=3D"styled-by-prettify" style=3D"color: #660;"=
>...</span><span class=3D"styled-by-prettify" style=3D"color: #606;">Ts</sp=
an><span class=3D"styled-by-prettify" style=3D"color: #660;">></span><sp=
an class=3D"styled-by-prettify" style=3D"color: #000;"><br></span><span cla=
ss=3D"styled-by-prettify" style=3D"color: #008;">struct</span><span class=
=3D"styled-by-prettify" style=3D"color: #000;"> types_from_tuple</span><spa=
n class=3D"styled-by-prettify" style=3D"color: #660;"><</span><span clas=
s=3D"styled-by-prettify" style=3D"color: #000;">named_tuple</span><span cla=
ss=3D"styled-by-prettify" style=3D"color: #660;"><</span><span class=3D"=
styled-by-prettify" style=3D"color: #606;">Ts</span><span class=3D"styled-b=
y-prettify" style=3D"color: #660;">...>></span><span class=3D"styled-=
by-prettify" style=3D"color: #000;"><br></span><span class=3D"styled-by-pre=
ttify" style=3D"color: #660;">{</span><span class=3D"styled-by-prettify" st=
yle=3D"color: #000;"><br>=C2=A0 </span><span class=3D"styled-by-prettify" s=
tyle=3D"color: #008;">using</span><span class=3D"styled-by-prettify" style=
=3D"color: #000;"> type </span><span class=3D"styled-by-prettify" style=3D"=
color: #660;">=3D</span><span class=3D"styled-by-prettify" style=3D"color: =
#000;"> type_list</span><span class=3D"styled-by-prettify" style=3D"color: =
#660;"><</span><span class=3D"styled-by-prettify" style=3D"color: #000;"=
>get_type_from_tag_t</span><span class=3D"styled-by-prettify" style=3D"colo=
r: #660;"><</span><span class=3D"styled-by-prettify" style=3D"color: #60=
6;">Ts</span><span class=3D"styled-by-prettify" style=3D"color: #660;">>=
....>;</span><span class=3D"styled-by-prettify" style=3D"color: #000;"><b=
r></span><span class=3D"styled-by-prettify" style=3D"color: #660;">};</span=
></div></code></div><div><br></div><div>The metafunction for your code'=
s equivalent would not be able to use expansion like that. Since every pair=
of `T` in the argument list contains the actual type, you would need to us=
e recursion to extract the list of `T`s. Not the hardest thing in the world=
, but hardly as straightforward as this.</div><div><br></div></div><blockqu=
ote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left=
: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><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"><div>I think this case properly illustr=
ates the syntax you designed, but could not prove the reasonableness of you=
r idea, because there seems to be little motivation for a user to design th=
e function template `func` defined above, and thus this case seems to be=C2=
=A0meaningless.</div></div></blockquote><div>Are you arguing that a demonst=
ration is not an use-case? That's weak.</div></div></blockquote><div>=
=C2=A0</div><div>What is so "weak" about it? An artificial exampl=
e that doesn't have real-world utility is not an effective motivation f=
or a feature. I admit that I'm not a deep metaprogramming expert, so it=
is entirely possible I'm missing something here. But thus far, I have =
not seen a genuinely compelling use case that cannot adequately be solved w=
ith some other mechanism.</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/65dd5a3b-990e-4916-b733-9f1a803691ae%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/65dd5a3b-990e-4916-b733-9f1a803691ae=
%40isocpp.org</a>.<br />
------=_Part_3134_1809895391.1513267617616--
------=_Part_3133_1253101455.1513267617615--
.
Author: bastienpenava@gmail.com
Date: Thu, 14 Dec 2017 08:53:54 -0800 (PST)
Raw View
------=_Part_1594_1950525150.1513270434820
Content-Type: multipart/alternative;
boundary="----=_Part_1595_1374569180.1513270434821"
------=_Part_1595_1374569180.1513270434821
Content-Type: text/plain; charset="UTF-8"
On Thursday, December 14, 2017 at 5:06:57 PM UTC+1, Nicol Bolas wrote:
>
> On Thursday, December 14, 2017 at 9:25:24 AM UTC-5, bastie...@gmail.com
> wrote:
>>
>> On Thursday, December 14, 2017 at 11:24:41 AM UTC+1, Mingxin Wang wrote:
>>>
>>> On Thursday, December 14, 2017 at 4:31:03 PM UTC+8, bastie...@gmail.com
>>> wrote
>>>
>> 2. I could not find a case that your idea could give full play to the
>>> advantages.
>>>
>> I can give you one that's would be simple to use and useful :
>> named_tuple.
>>
>> named_tuple<int, "age", string, "name"> x;
>> x.get<"name">() = get_user_name();
>> static_assert(std::is_same_v<std::string &, decltype(std::get<1>())>);
>>
>>
> Which can be accomplished adequately enough in other ways (assuming we
> allow strings in template parameters):
>
strings as template parameters was adopted by the evolution working group
during the meeting of November :
https://botondballo.wordpress.com/2017/11/20/trip-report-c-standards-meeting-in-albuquerque-november-2017/
<https://botondballo.wordpress.com/2017/11/20/trip-report-c-standards-meeting-in-albuquerque-november-2017/>
>
> named_tuple<tag<"age", int>, tag<"name", string>>;
>
>
Indeed, I think this would be a much better solution. First, it allows you
> to have named_tuples with unnamed elements (`named_tuple<int, tag<"name",
> string>>`). Second, I think it makes it easier on the implementation side.
> For example, if you want to write a metafunction that takes a
> `named_tuple<...>` and generates a list of its types, you can do this:
>
> template<typename T>
> struct get_type_from_tag
> {
> using type = T;
> };
>
> template<const char *Str, typename T>
> struct get_type_from_tag<tag<Str, T>
> {
> using type = T;
> };
>
> template<T>
> using get_type_from_tag_t = typename get_type_from_tag<T>::type;
>
> template<typename Tpl>
> struct types_from_tuple {};
>
> template<typename ...Ts>
> struct types_from_tuple<named_tuple<Ts...>>
> {
> using type = type_list<get_type_from_tag_t<Ts>...>;
> };
>
> The metafunction for your code's equivalent would not be able to use
> expansion like that. Since every pair of `T` in the argument list contains
> the actual type, you would need to use recursion to extract the list of
> `T`s. Not the hardest thing in the world, but hardly as straightforward as
> this.
>
I agree that it can be expressed through type tagging. That being said do
you think that such a solution could ever be part of std?
This is an odd pattern that requires implementation knowledge on the part
of the user.
On the implementation side I've worked on a non-recursive implementation
that would rely on lambdas in unevaluated context (also opted in C++20) and
that I believe could also allow optional names.
That being said it is more difficult to write but library features are
usually more difficult to write the more they wish to be easy to use.
> I think this case properly illustrates the syntax you designed, but could
>>> not prove the reasonableness of your idea, because there seems to be little
>>> motivation for a user to design the function template `func` defined above,
>>> and thus this case seems to be meaningless.
>>>
>> Are you arguing that a demonstration is not an use-case? That's weak.
>>
>
> What is so "weak" about it? An artificial example that doesn't have
> real-world utility is not an effective motivation for a feature. I admit
> that I'm not a deep metaprogramming expert, so it is entirely possible I'm
> missing something here. But thus far, I have not seen a genuinely
> compelling use case that cannot adequately be solved with some other
> mechanism.
>
What is weak is to argue that an illustration used to showcase how
something would work is a bad use case. It's not a use case and wasn't
written to be one.
--
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/66b6077a-04bd-4b09-bb74-2e6d677590eb%40isocpp.org.
------=_Part_1595_1374569180.1513270434821
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Thursday, December 14, 2017 at 5:06:57 PM UTC+1, Nicol =
Bolas wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-lef=
t: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">O=
n Thursday, December 14, 2017 at 9:25:24 AM UTC-5, <a>bastie...@gmail.com</=
a> wrote:<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 Thursd=
ay, December 14, 2017 at 11:24:41 AM UTC+1, Mingxin Wang wrote:<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 Thursday, December 14, 2017=
at 4:31:03 PM UTC+8, <a>bastie...@gmail.com</a> wrote</div></blockquote></=
div></blockquote><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"><=
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">2. I could not find=
a case that your idea could give full play to the advantages.</div></block=
quote></div></blockquote><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"><div>=C2=A0I can give you one that's would be simple to use an=
d useful : named_tuple.</div><div><br></div><div style=3D"background-color:=
rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-wi=
dth:1px;word-wrap:break-word"><code><div><span style=3D"color:#000">named_t=
uple</span><span style=3D"color:#660"><</span><span style=3D"color:#008"=
>int</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> <=
/span><span style=3D"color:#080">"age"</span><span style=3D"color=
:#660">,</span><span style=3D"color:#000"> </span><span style=3D"color:#008=
">string</span><span style=3D"color:#660">,</span><span style=3D"color:#000=
"> </span><span style=3D"color:#080">"name"</span><span style=3D"=
color:#660">></span><span style=3D"color:#000"> x</span><span style=3D"c=
olor:#660">;</span><span style=3D"color:#000"><br>x</span><span style=3D"co=
lor:#660">.</span><span style=3D"color:#008">get</span><span style=3D"color=
:#660"><</span><span style=3D"color:#080">"name"</span><span s=
tyle=3D"color:#660">>()</span><span style=3D"color:#000"> </span><span s=
tyle=3D"color:#660">=3D</span><span style=3D"color:#000"> get_user_name</sp=
an><span style=3D"color:#660">();</span><span style=3D"color:#000"><br></sp=
an><span style=3D"color:#008">static_assert</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">is_same_v</span><span style=3D"color:#66=
0"><</span><span style=3D"color:#000">s<wbr>td</span><span style=3D"colo=
r:#660">::</span><span style=3D"color:#008">string</span><span style=3D"col=
or:#000"> </span><span style=3D"color:#660">&,</span><span style=3D"col=
or:#000"> </span><span style=3D"color:#008">decltype</span><span style=3D"c=
olor:#660">(</span><span style=3D"color:#000">std</span><span style=3D"colo=
r:#660">::</span><span style=3D"color:#008">get</span><span style=3D"color:=
#660"><</span><span style=3D"color:#066">1</span><span style=3D"color:#6=
60">>())>);</span></div></code></div><div><br></div></div></blockquot=
e><div><br></div><div><div>Which can be accomplished adequately enough in o=
ther ways (assuming we allow strings in template parameters):=C2=A0</div></=
div></div></blockquote><div>strings as template parameters was adopted by t=
he evolution working group during the meeting of November :=C2=A0<a href=3D=
"https://botondballo.wordpress.com/2017/11/20/trip-report-c-standards-meeti=
ng-in-albuquerque-november-2017/">https://botondballo.wordpress.com/2017/11=
/20/trip-report-c-standards-meeting-in-albuquerque-november-2017/=C2=A0</a>=
</div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8=
ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><d=
iv><br></div><div style=3D"border:1px solid rgb(187,187,187);word-wrap:brea=
k-word;background-color:rgb(250,250,250)"><code><div><span style=3D"color:#=
000">named_tuple</span><span style=3D"color:#660"><</span><span style=3D=
"color:#000">tag</span><span style=3D"color:#660"><</span><span style=3D=
"color:#080">"age"</span><span style=3D"color:#660">,</span><span=
style=3D"color:#000"> </span><span style=3D"color:#008">int</span><span st=
yle=3D"color:#660">>,</span><span style=3D"color:#000"> tag</span><span =
style=3D"color:#660"><</span><span style=3D"color:#080">"name"=
</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#008">string</span><span style=3D"color:#660">>&g=
t;;</span></div></code></div><div>=C2=A0<br></div></div></div></blockquote>=
<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;bor=
der-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><div></d=
iv><div>Indeed,
I think this would be a much better solution. First, it allows you to have=
named_tuples with unnamed elements (`named_tuple<int, tag<"name=
", string>>`). Second, I think it makes it easier on the impleme=
ntation=20
side. For example, if you=20
want to write a metafunction that takes a `named_tuple<...>`=20
and generates a list of its types, you can do this:</div><div><br></div><di=
v style=3D"border:1px solid rgb(187,187,187);word-wrap:break-word;backgroun=
d-color:rgb(250,250,250)"><code><div><span style=3D"color:#008">template</s=
pan><span style=3D"color:#660"><</span><span style=3D"color:#008">typena=
me</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:#008">st=
ruct</span><span style=3D"color:#000"> get_type_from_tag<br></span><span st=
yle=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 </span><sp=
an style=3D"color:#008">using</span><span style=3D"color:#000"> type </span=
><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> T</span><=
span style=3D"color:#660">;</span><span style=3D"color:#000"><br></span><sp=
an 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"><</=
span><span style=3D"color:#008">const</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#008">char</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#660">*</span><span style=3D"color:#606">Str</span><=
span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><span =
style=3D"color:#008">typename</span><span style=3D"color:#000"> T</span><sp=
an style=3D"color:#660">></span><span style=3D"color:#000"><br></span><s=
pan style=3D"color:#008">struct</span><span style=3D"color:#000"> get_type_=
from_tag</span><span style=3D"color:#660"><</span><span style=3D"color:#=
000">tag</span><span style=3D"color:#660"><</span><span style=3D"color:#=
606">Str</span><span style=3D"color:#660">,</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><span style=3D"color:#000"><=
br>=C2=A0 </span><span style=3D"color:#008">using</span><span style=3D"colo=
r:#000"> type </span><span style=3D"color:#660">=3D</span><span style=3D"co=
lor:#000"> 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><br></span><span style=3D"color:#008">template</span><span style=
=3D"color:#660"><</span><span style=3D"color:#000">T</span><span style=
=3D"color:#660">></span><span style=3D"color:#000"><br></span><span styl=
e=3D"color:#008">using</span><span style=3D"color:#000"> get_type_from_tag_=
t </span><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> <=
/span><span style=3D"color:#008">typename</span><span style=3D"color:#000">=
get_type_from_tag</span><span style=3D"color:#660"><</span><span style=
=3D"color:#000">T</span><span style=3D"color:#660">>::</span><span style=
=3D"color:#000">type</span><span style=3D"color:#660">;</span><span style=
=3D"color:#000"><br><br></span><span style=3D"color:#008">template</span><s=
pan style=3D"color:#660"><</span><span style=3D"color:#008">typename</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#606">Tpl</span>=
<span style=3D"color:#660">></span><span style=3D"color:#000"><br></span=
><span style=3D"color:#008">struct</span><span style=3D"color:#000"> types_=
from_tuple </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"><</span><span style=3D"color:#008">typename</span><span =
style=3D"color:#000"> </span><span style=3D"color:#660">...</span><span sty=
le=3D"color:#606">Ts</span><span style=3D"color:#660">></span><span styl=
e=3D"color:#000"><br></span><span style=3D"color:#008">struct</span><span s=
tyle=3D"color:#000"> types_from_tuple</span><span style=3D"color:#660"><=
</span><span style=3D"color:#000">named_tuple</span><span style=3D"color:#6=
60"><</span><span style=3D"color:#606">T<wbr>s</span><span style=3D"colo=
r:#660">...>></span><span style=3D"color:#000"><br></span><span style=
=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 </span><span =
style=3D"color:#008">using</span><span style=3D"color:#000"> type </span><s=
pan style=3D"color:#660">=3D</span><span style=3D"color:#000"> type_list</s=
pan><span style=3D"color:#660"><</span><span style=3D"color:#000">get_ty=
pe_from_tag_t</span><span style=3D"color:#660"><</span><span style=3D"co=
lor:#606"><wbr>Ts</span><span style=3D"color:#660">>...>;</span><span=
style=3D"color:#000"><br></span><span style=3D"color:#660">};</span></div>=
</code></div><div><br></div><div>The metafunction for your code's equiv=
alent would not be able to use expansion like that. Since every pair of `T`=
in the argument list contains the actual type, you would need to use recur=
sion to extract the list of `T`s. Not the hardest thing in the world, but h=
ardly as straightforward as this.</div></div></div></blockquote><div><br></=
div><div>I agree that it can be expressed through type tagging. That being =
said do you think that such a solution could ever be part of std?</div><div=
>This is an odd pattern that requires implementation knowledge on the part =
of the user.</div><div>On the implementation side I've worked on a non-=
recursive implementation that would rely on lambdas in unevaluated context =
(also opted in C++20) and that I believe could also allow optional names.</=
div><div>That being said it is more difficult to write but library features=
are usually more difficult to write the more they wish to be easy to use.<=
/div><div><br></div><blockquote class=3D"gmail_quote" style=3D"margin: 0;ma=
rgin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr"><div><div><br></div></div><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"><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"ltr">=
<div>I think this case properly illustrates the syntax you designed, but co=
uld not prove the reasonableness of your idea, because there seems to be li=
ttle motivation for a user to design the function template `func` defined a=
bove, and thus this case seems to be=C2=A0meaningless.</div></div></blockqu=
ote><div>Are you arguing that a demonstration is not an use-case? That'=
s weak.</div></div></blockquote><div>=C2=A0</div><div>What is so "weak=
" about it? An artificial example that doesn't have real-world uti=
lity is not an effective motivation for a feature. I admit that I'm not=
a deep metaprogramming expert, so it is entirely possible I'm missing =
something here. But thus far, I have not seen a genuinely compelling use ca=
se that cannot adequately be solved with some other mechanism.</div></div><=
/blockquote><div>What is weak is to argue that an illustration used to show=
case how something would work is a bad use case. It's not a use case an=
d wasn't written to be one.</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/66b6077a-04bd-4b09-bb74-2e6d677590eb%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/66b6077a-04bd-4b09-bb74-2e6d677590eb=
%40isocpp.org</a>.<br />
------=_Part_1595_1374569180.1513270434821--
------=_Part_1594_1950525150.1513270434820--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Thu, 14 Dec 2017 09:30:42 -0800 (PST)
Raw View
------=_Part_3432_25218606.1513272642888
Content-Type: multipart/alternative;
boundary="----=_Part_3433_1833812400.1513272642889"
------=_Part_3433_1833812400.1513272642889
Content-Type: text/plain; charset="UTF-8"
On Thursday, December 14, 2017 at 11:53:55 AM UTC-5, bastie...@gmail.com
wrote:
>
> On Thursday, December 14, 2017 at 5:06:57 PM UTC+1, Nicol Bolas wrote:
>>
>> On Thursday, December 14, 2017 at 9:25:24 AM UTC-5, bastie...@gmail.com
>> wrote:
>>>
>>> On Thursday, December 14, 2017 at 11:24:41 AM UTC+1, Mingxin Wang wrote:
>>>>
>>>> On Thursday, December 14, 2017 at 4:31:03 PM UTC+8, bastie...@gmail.com
>>>> wrote
>>>>
>>> 2. I could not find a case that your idea could give full play to the
>>>> advantages.
>>>>
>>> I can give you one that's would be simple to use and useful :
>>> named_tuple.
>>>
>>> named_tuple<int, "age", string, "name"> x;
>>> x.get<"name">() = get_user_name();
>>> static_assert(std::is_same_v<std::string &, decltype(std::get<1>())>);
>>>
>>>
>> Which can be accomplished adequately enough in other ways (assuming we
>> allow strings in template parameters):
>>
> strings as template parameters was adopted by the evolution working group
> during the meeting of November :
> https://botondballo.wordpress.com/2017/11/20/trip-report-c-standards-meeting-in-albuquerque-november-2017/
> <https://botondballo.wordpress.com/2017/11/20/trip-report-c-standards-meeting-in-albuquerque-november-2017/>
>
>>
>> named_tuple<tag<"age", int>, tag<"name", string>>;
>>
>>
> Indeed, I think this would be a much better solution. First, it allows you
>> to have named_tuples with unnamed elements (`named_tuple<int, tag<"name",
>> string>>`). Second, I think it makes it easier on the implementation side.
>> For example, if you want to write a metafunction that takes a
>> `named_tuple<...>` and generates a list of its types, you can do this:
>>
>> template<typename T>
>> struct get_type_from_tag
>> {
>> using type = T;
>> };
>>
>> template<const char *Str, typename T>
>> struct get_type_from_tag<tag<Str, T>
>> {
>> using type = T;
>> };
>>
>> template<T>
>> using get_type_from_tag_t = typename get_type_from_tag<T>::type;
>>
>> template<typename Tpl>
>> struct types_from_tuple {};
>>
>> template<typename ...Ts>
>> struct types_from_tuple<named_tuple<Ts...>>
>> {
>> using type = type_list<get_type_from_tag_t<Ts>...>;
>> };
>>
>> The metafunction for your code's equivalent would not be able to use
>> expansion like that. Since every pair of `T` in the argument list contains
>> the actual type, you would need to use recursion to extract the list of
>> `T`s. Not the hardest thing in the world, but hardly as straightforward as
>> this.
>>
>
> I agree that it can be expressed through type tagging. That being said do
> you think that such a solution could ever be part of std?
>
.... why not?
Whether you use a tag type or your suggestion, it would be a very breaking
change to allow `std::tuple` itself to gain this feature. After all, people
already have a lot of code that expects `tuple` to take only typenames, and
that those typenames directly map to the types the `tuple` stores.
So however it happens, it must be a new type. And there's no reason why the
`tag`ed version couldn't be standardized.
This is an odd pattern that requires implementation knowledge on the part
> of the user.
>
No more odd than the idea that you pass a sequence of string and type
pairs. Certainly, no other type accepts such a thing at present.
By contrast, while the standard library doesn't use tagged template
parameters, there are several C++ libraries that do. So at least some
programmers are familiar with the concept.
On the implementation side I've worked on a non-recursive implementation
> that would rely on lambdas in unevaluated context (also opted in C++20) and
> that I believe could also allow optional names.
> That being said it is more difficult to write but library features are
> usually more difficult to write the more they wish to be easy to use.
>
I thought the whole point of this feature was to make template programming*
easier*, not harder.
--
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/40ad6a03-88d7-4057-b5a4-490cd4746ee1%40isocpp.org.
------=_Part_3433_1833812400.1513272642889
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Thursday, December 14, 2017 at 11:53:55 AM UTC-5, basti=
e...@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;m=
argin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr">On Thursday, December 14, 2017 at 5:06:57 PM UTC+1, Nicol Bolas wr=
ote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;b=
order-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">On Thursday, D=
ecember 14, 2017 at 9:25:24 AM UTC-5, <a>bastie...@gmail.com</a> wrote:<blo=
ckquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-le=
ft:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">On Thursday, December =
14, 2017 at 11:24:41 AM UTC+1, Mingxin Wang wrote:<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">On Thursday, December 14, 2017 at 4:31:03 P=
M UTC+8, <a>bastie...@gmail.com</a> wrote</div></blockquote></div></blockqu=
ote><blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;b=
order-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><blockquote cl=
ass=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #cc=
c solid;padding-left:1ex"><div dir=3D"ltr">2. I could not find a case that =
your idea could give full play to the advantages.</div></blockquote></div><=
/blockquote><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"><div>=
=C2=A0I can give you one that's would be simple to use and useful : nam=
ed_tuple.</div><div><br></div><div style=3D"background-color:rgb(250,250,25=
0);border-color:rgb(187,187,187);border-style:solid;border-width:1px;word-w=
rap:break-word"><code><div><span style=3D"color:#000">named_tuple</span><sp=
an style=3D"color:#660"><</span><span style=3D"color:#008">int</span><sp=
an style=3D"color:#660">,</span><span style=3D"color:#000"> </span><span st=
yle=3D"color:#080">"age"</span><span style=3D"color:#660">,</span=
><span style=3D"color:#000"> </span><span style=3D"color:#008">string</span=
><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><spa=
n style=3D"color:#080">"name"</span><span style=3D"color:#660">&g=
t;</span><span style=3D"color:#000"> x</span><span style=3D"color:#660">;</=
span><span style=3D"color:#000"><br>x</span><span style=3D"color:#660">.</s=
pan><span style=3D"color:#008">get</span><span style=3D"color:#660"><</s=
pan><span style=3D"color:#080">"name"</span><span style=3D"color:=
#660">>()</span><span style=3D"color:#000"> </span><span style=3D"color:=
#660">=3D</span><span style=3D"color:#000"> get_user_name</span><span style=
=3D"color:#660">();</span><span style=3D"color:#000"><br></span><span style=
=3D"color:#008">static_assert</span><span style=3D"color:#660">(</span><spa=
n style=3D"color:#000">std</span><span style=3D"color:#660">::</span><span =
style=3D"color:#000">is_same_v</span><span style=3D"color:#660"><</span>=
<span style=3D"color:#000">s<wbr>td</span><span style=3D"color:#660">::</sp=
an><span style=3D"color:#008">string</span><span style=3D"color:#000"> </sp=
an><span style=3D"color:#660">&,</span><span style=3D"color:#000"> </sp=
an><span style=3D"color:#008">decltype</span><span style=3D"color:#660">(</=
span><span style=3D"color:#000">std</span><span style=3D"color:#660">::</sp=
an><span style=3D"color:#008">get</span><span style=3D"color:#660"><</sp=
an><span style=3D"color:#066">1</span><span style=3D"color:#660">>())>=
;);</span></div></code></div><div><br></div></div></blockquote><div><br></d=
iv><div><div>Which can be accomplished adequately enough in other ways (ass=
uming we allow strings in template parameters):=C2=A0</div></div></div></bl=
ockquote><div>strings as template parameters was adopted by the evolution w=
orking group during the meeting of November :=C2=A0<a onmousedown=3D"this.h=
ref=3D'https://www.google.com/url?q\x3dhttps%3A%2F%2Fbotondballo.wordpr=
ess.com%2F2017%2F11%2F20%2Ftrip-report-c-standards-meeting-in-albuquerque-n=
ovember-2017%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF_vL5Ngr4VIpnzXg9U_=
LHKICBxaA';return true;" onclick=3D"this.href=3D'https://www.google=
..com/url?q\x3dhttps%3A%2F%2Fbotondballo.wordpress.com%2F2017%2F11%2F20%2Ftr=
ip-report-c-standards-meeting-in-albuquerque-november-2017%2F\x26sa\x3dD\x2=
6sntz\x3d1\x26usg\x3dAFQjCNF_vL5Ngr4VIpnzXg9U_LHKICBxaA';return true;" =
href=3D"https://botondballo.wordpress.com/2017/11/20/trip-report-c-standard=
s-meeting-in-albuquerque-november-2017/" target=3D"_blank" rel=3D"nofollow"=
>https://botondballo.<wbr>wordpress.com/2017/11/20/trip-<wbr>report-c-stand=
ards-meeting-in-<wbr>albuquerque-november-2017/=C2=A0</a></div><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"><div><div><br></div><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:#000">named_tuple</span>=
<span style=3D"color:#660"><</span><span style=3D"color:#000">tag</span>=
<span style=3D"color:#660"><</span><span style=3D"color:#080">"age&=
quot;</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"> tag</span><span style=3D"color:#660">&l=
t;</span><span style=3D"color:#080">"name"</span><span style=3D"c=
olor:#660">,</span><span style=3D"color:#000"> </span><span style=3D"color:=
#008">string</span><span style=3D"color:#660">>>;</span></div></code>=
</div><div>=C2=A0<br></div></div></div></blockquote><blockquote class=3D"gm=
ail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;p=
adding-left:1ex"><div dir=3D"ltr"><div><div></div><div>Indeed,
I think this would be a much better solution. First, it allows you to have=
named_tuples with unnamed elements (`named_tuple<int, tag<"name=
", string>>`). Second, I think it makes it easier on the impleme=
ntation=20
side. For example, if you=20
want to write a metafunction that takes a `named_tuple<...>`=20
and generates a list of its types, you can do this:</div><div><br></div><di=
v style=3D"border:1px solid rgb(187,187,187);word-wrap:break-word;backgroun=
d-color:rgb(250,250,250)"><code><div><span style=3D"color:#008">template</s=
pan><span style=3D"color:#660"><</span><span style=3D"color:#008">typena=
me</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:#008">st=
ruct</span><span style=3D"color:#000"> get_type_from_tag<br></span><span st=
yle=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 </span><sp=
an style=3D"color:#008">using</span><span style=3D"color:#000"> type </span=
><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> T</span><=
span style=3D"color:#660">;</span><span style=3D"color:#000"><br></span><sp=
an 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"><</=
span><span style=3D"color:#008">const</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#008">char</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#660">*</span><span style=3D"color:#606">Str</span><=
span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><span =
style=3D"color:#008">typename</span><span style=3D"color:#000"> T</span><sp=
an style=3D"color:#660">></span><span style=3D"color:#000"><br></span><s=
pan style=3D"color:#008">struct</span><span style=3D"color:#000"> get_type_=
from_tag</span><span style=3D"color:#660"><</span><span style=3D"color:#=
000">tag</span><span style=3D"color:#660"><</span><span style=3D"color:#=
606">Str</span><span style=3D"color:#660">,</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><span style=3D"color:#000"><=
br>=C2=A0 </span><span style=3D"color:#008">using</span><span style=3D"colo=
r:#000"> type </span><span style=3D"color:#660">=3D</span><span style=3D"co=
lor:#000"> 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><br></span><span style=3D"color:#008">template</span><span style=
=3D"color:#660"><</span><span style=3D"color:#000">T</span><span style=
=3D"color:#660">></span><span style=3D"color:#000"><br></span><span styl=
e=3D"color:#008">using</span><span style=3D"color:#000"> get_type_from_tag_=
t </span><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> <=
/span><span style=3D"color:#008">typename</span><span style=3D"color:#000">=
get_type_from_tag</span><span style=3D"color:#660"><</span><span style=
=3D"color:#000">T</span><span style=3D"color:#660">>::</span><span style=
=3D"color:#000">type</span><span style=3D"color:#660">;</span><span style=
=3D"color:#000"><br><br></span><span style=3D"color:#008">template</span><s=
pan style=3D"color:#660"><</span><span style=3D"color:#008">typename</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#606">Tpl</span>=
<span style=3D"color:#660">></span><span style=3D"color:#000"><br></span=
><span style=3D"color:#008">struct</span><span style=3D"color:#000"> types_=
from_tuple </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"><</span><span style=3D"color:#008">typename</span><span =
style=3D"color:#000"> </span><span style=3D"color:#660">...</span><span sty=
le=3D"color:#606">Ts</span><span style=3D"color:#660">></span><span styl=
e=3D"color:#000"><br></span><span style=3D"color:#008">struct</span><span s=
tyle=3D"color:#000"> types_from_tuple</span><span style=3D"color:#660"><=
</span><span style=3D"color:#000">named_tuple</span><span style=3D"color:#6=
60"><</span><span style=3D"color:#606">T<wbr>s</span><span style=3D"colo=
r:#660">...>></span><span style=3D"color:#000"><br></span><span style=
=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 </span><span =
style=3D"color:#008">using</span><span style=3D"color:#000"> type </span><s=
pan style=3D"color:#660">=3D</span><span style=3D"color:#000"> type_list</s=
pan><span style=3D"color:#660"><</span><span style=3D"color:#000">get_ty=
pe_from_tag_t</span><span style=3D"color:#660"><</span><span style=3D"co=
lor:#606"><wbr>Ts</span><span style=3D"color:#660">>...>;</span><span=
style=3D"color:#000"><br></span><span style=3D"color:#660">};</span></div>=
</code></div><div><br></div><div>The metafunction for your code's equiv=
alent would not be able to use expansion like that. Since every pair of `T`=
in the argument list contains the actual type, you would need to use recur=
sion to extract the list of `T`s. Not the hardest thing in the world, but h=
ardly as straightforward as this.</div></div></div></blockquote><div><br></=
div><div>I agree that it can be expressed through type tagging. That being =
said do you think that such a solution could ever be part of std?</div></di=
v></blockquote><div><br></div><div>... why not?</div><div><br></div><div>Wh=
ether you use a tag type or your suggestion, it would be a very breaking ch=
ange to allow `std::tuple` itself to gain this feature. After all, people a=
lready have a lot of code that expects `tuple` to take only typenames, and =
that those typenames directly map to the types the `tuple` stores.</div><di=
v><br></div><div>So however it happens, it must be a new type. And there=
9;s no reason why the `tag`ed version couldn't be standardized.</div><d=
iv><br></div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-le=
ft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">=
<div>This is an odd pattern that requires implementation knowledge on the p=
art of the user.</div></div></blockquote><div><br></div><div>No more odd th=
an the idea that you pass a sequence of string and type pairs. Certainly, n=
o other type accepts such a thing at present.</div><div><br></div><div>By c=
ontrast, while the standard library doesn't use tagged template paramet=
ers, there are several C++ libraries that do. So at least some programmers =
are familiar with the concept.</div><div><br></div><blockquote class=3D"gma=
il_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid=
;padding-left: 1ex;"><div dir=3D"ltr"><div>On the implementation side I'=
;ve worked on a non-recursive implementation that would rely on lambdas in =
unevaluated context (also opted in C++20) and that I believe could also all=
ow optional names.</div><div>That being said it is more difficult to write =
but library features are usually more difficult to write the more they wish=
to be easy to use.</div></div></blockquote><div><br></div><div>I thought t=
he whole point of this feature was to make template programming<i> easier</=
i>, not harder.</div><div><br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/40ad6a03-88d7-4057-b5a4-490cd4746ee1%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/40ad6a03-88d7-4057-b5a4-490cd4746ee1=
%40isocpp.org</a>.<br />
------=_Part_3433_1833812400.1513272642889--
------=_Part_3432_25218606.1513272642888--
.
Author: adrian.hawryluk@gmail.com
Date: Sat, 16 Dec 2017 06:23:05 -0800 (PST)
Raw View
------=_Part_5453_1547896633.1513434185635
Content-Type: multipart/alternative;
boundary="----=_Part_5454_1433718844.1513434185635"
------=_Part_5454_1433718844.1513434185635
Content-Type: text/plain; charset="UTF-8"
On Wednesday, December 13, 2017 at 10:09:41 PM UTC-5, Mingxin Wang wrote:
>
> On Thursday, December 14, 2017 at 4:45:07 AM UTC+8, adrian....@gmail.com
> wrote:
>>
>> Some time ago I participate in discussion of similar feature. One
>>> difference was that was using `using` keyword to introduce unknown type of
>>> template parameters. I think use in this context will be consisting with
>>> rest of language because you can `using` not only types but function too.
>>>
>>
>> Well, I think using is better keyword to use than the bare template keyword
>> IMHO. When I see template, I just expect to see a template there, not
>> any TPT. Other alternatives I considered were auto, as it would
>> automatically match any TPT, but that is currently in use now, and *
>> (asterix), which is like a glob that matches everything. The use of no
>> keyword was a fairly obvious mnemonic, I didn't specify what TPT, so allow
>> any TPT.
>>
>> Quite honestly, I don't really mind any of these alternatives, but I
>> think that we should not be limited like we are now. This feature is a
>> long time coming and should be added to the language.
>>
>> What other differences were there in the other discussion you had? What
>> reason was given to blockade this type of feature?
>>
>
> I think "allowing any parameter in a template" is a common demand,
> especially in compile-time programming.
>
> With the standard we have now, one is always required to specify the types
> of the parameters declared in a template. In order to define the semantics
> of the template explicitly, the class template `std::integral_constant` was
> introduced, so that users are able to pass any integral constants with the
> template. However, I think `integral_constant` is inappropriately named,
> and there seem to be little necessity in defining any member types or
> constants in it, because these metadata is already passed by templates.
>
> In order to standardize the expressions to pass various sort of metadata
> to templates, the class templates `in_place_arg_t` and
> `in_place_resource_t` were proposed in one of my earlier posts (
> https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/Gb3CFKiGLfo)
> and in my recent proposal p0801 (
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0801r0.pdf).
>
> What do you think of my solution? I am looking forward to your comments
> and suggestions.
>
> Mingxin Wang
>
Although your proposal is interesting, I don't see how it relates to this
thread.
--
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/55639628-94a8-4fe6-bdf5-7366d0e5b13d%40isocpp.org.
------=_Part_5454_1433718844.1513434185635
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Wednesday, December 13, 2017 at 10:09:41 PM UTC-5, Ming=
xin Wang wrote:<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 Thursday, December 14, 2017 at 4:45:07 AM UTC+8, <a>adrian....@gmail.c=
om</a> wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-lef=
t:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-lef=
t:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>Some time ago I pa=
rticipate in discussion of similar feature. One difference was that was usi=
ng `using` keyword to introduce unknown type of template parameters. I thin=
k use in this context will be consisting with rest of language because you =
can `using` not only types but function too.<br></div></div></blockquote><d=
iv><br></div><div>Well, I think <font face=3D"courier new, monospace">using=
</font>is better keyword to use than the bare <font face=3D"courier new, m=
onospace">template </font>keyword IMHO.=C2=A0 =C2=A0When I see <font face=
=3D"courier new, monospace">template</font>, I just expect to see a templat=
e there, not any TPT.=C2=A0 Other alternatives I considered were <font face=
=3D"courier new, monospace">auto</font>, as it would automatically match an=
y TPT, but that is currently in use now, and <font face=3D"courier new, mon=
ospace">*</font><font face=3D"arial, sans-serif"> (asterix)</font>, which i=
s like a glob that matches everything.=C2=A0 The use of no keyword was a fa=
irly obvious mnemonic, I didn't specify what TPT, so allow any TPT.</di=
v><div><br></div><div>Quite honestly, I don't really mind any of these =
alternatives, but I think that we should not be limited like we are now.=C2=
=A0 This feature is a long time coming and should be added to the language.=
</div><div><br></div><div>What other differences were there in the other di=
scussion you had?=C2=A0 What reason was given to blockade this type of feat=
ure?</div></div></blockquote><div><br></div><div>I think "allowing any=
parameter in a template" is a common demand, especially in compile-ti=
me programming.</div><div><br></div><div>With the standard we have now, one=
is always required to specify the types of the parameters declared in a te=
mplate. In order to define the semantics of the template explicitly, the cl=
ass template `std::integral_constant` was introduced, so that users are abl=
e to pass any integral constants with the template.=C2=A0However, I think `=
integral_constant` is inappropriately named, and there seem to be little ne=
cessity in defining any member types or constants in it, because these meta=
data is already passed by templates.</div><div><br></div><div>In order to s=
tandardize the expressions to pass various sort of metadata to templates, t=
he class templates `in_place_arg_t` and `in_place_resource_t` were proposed=
in one of my earlier posts (<a href=3D"https://groups.google.com/a/isocpp.=
org/forum/#!topic/std-proposals/Gb3CFKiGLfo" target=3D"_blank" rel=3D"nofol=
low" onmousedown=3D"this.href=3D'https://groups.google.com/a/isocpp.org=
/forum/#!topic/std-proposals/Gb3CFKiGLfo';return true;" onclick=3D"this=
..href=3D'https://groups.google.com/a/isocpp.org/forum/#!topic/std-propo=
sals/Gb3CFKiGLfo';return true;">https://groups.google.com/a/<wbr>isocpp=
..org/forum/#!topic/std-<wbr>proposals/Gb3CFKiGLfo</a>) and in my recent pro=
posal p0801 (<a href=3D"http://www.open-std.org/jtc1/sc22/wg21/docs/papers/=
2017/p0801r0.pdf" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.hr=
ef=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.open-std.org%2Fjt=
c1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2017%2Fp0801r0.pdf\x26sa\x3dD\x26sntz\x3=
d1\x26usg\x3dAFQjCNHUBA6lny0Om6vqELlmXbyHKDdCdQ';return true;" onclick=
=3D"this.href=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.open-s=
td.org%2Fjtc1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2017%2Fp0801r0.pdf\x26sa\x3dD=
\x26sntz\x3d1\x26usg\x3dAFQjCNHUBA6lny0Om6vqELlmXbyHKDdCdQ';return true=
;">http://www.open-std.org/jtc1/<wbr>sc22/wg21/docs/papers/2017/<wbr>p0801r=
0.pdf</a>).</div><div><br></div><div>What do you think of my solution? I am=
looking forward to your comments and suggestions.<br></div><div><br></div>=
<div>Mingxin Wang</div></div></blockquote><div>=C2=A0</div><div>Although yo=
ur proposal is interesting, I don't see how it relates to this thread.=
=C2=A0</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/55639628-94a8-4fe6-bdf5-7366d0e5b13d%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/55639628-94a8-4fe6-bdf5-7366d0e5b13d=
%40isocpp.org</a>.<br />
------=_Part_5454_1433718844.1513434185635--
------=_Part_5453_1547896633.1513434185635--
.
Author: adrian.hawryluk@gmail.com
Date: Sat, 16 Dec 2017 07:01:21 -0800 (PST)
Raw View
------=_Part_79_891027830.1513436482066
Content-Type: multipart/alternative;
boundary="----=_Part_80_1109978460.1513436482066"
------=_Part_80_1109978460.1513436482066
Content-Type: text/plain; charset="UTF-8"
On Wednesday, December 13, 2017 at 10:09:41 PM UTC-5, Mingxin Wang wrote:
>
> On Thursday, December 14, 2017 at 4:45:07 AM UTC+8, adrian....@gmail.com
> wrote:
>>
>> Some time ago I participate in discussion of similar feature. One
>>> difference was that was using `using` keyword to introduce unknown type of
>>> template parameters. I think use in this context will be consisting with
>>> rest of language because you can `using` not only types but function too.
>>>
>>
>> Well, I think using is better keyword to use than the bare template keyword
>> IMHO. When I see template, I just expect to see a template there, not
>> any TPT. Other alternatives I considered were auto, as it would
>> automatically match any TPT, but that is currently in use now, and *
>> (asterix), which is like a glob that matches everything. The use of no
>> keyword was a fairly obvious mnemonic, I didn't specify what TPT, so allow
>> any TPT.
>>
>> Quite honestly, I don't really mind any of these alternatives, but I
>> think that we should not be limited like we are now. This feature is a
>> long time coming and should be added to the language.
>>
>> What other differences were there in the other discussion you had? What
>> reason was given to blockade this type of feature?
>>
>
> I think "allowing any parameter in a template" is a common demand,
> especially in compile-time programming.
>
> With the standard we have now, one is always required to specify the types
> of the parameters declared in a template. In order to define the semantics
> of the template explicitly, the class template `std::integral_constant` was
> introduced, so that users are able to pass any integral constants with the
> template. However, I think `integral_constant` is inappropriately named,
> and there seem to be little necessity in defining any member types or
> constants in it, because these metadata is already passed by templates.
>
> In order to standardize the expressions to pass various sort of metadata
> to templates, the class templates `in_place_arg_t` and
> `in_place_resource_t` were proposed in one of my earlier posts (
> https://groups.google.com/a/isocpp.org/forum/#!topic/std-proposals/Gb3CFKiGLfo)
> and in my recent proposal p0801 (
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2017/p0801r0.pdf).
>
> What do you think of my solution? I am looking forward to your comments
> and suggestions.
>
> Mingxin Wang
>
Although your proposal is interesting, I don't see how it relates to this
thread.
This thread isn't about how we can encapsulate an type (if that is what you
are getting at, which doesn't seem to be the case as you can't encapsulate
templates in that manner). This is about being able to accept and
manipulate any TPT, thus allowing more general transforms of any template.
My tbind example above is a real world example of this.
--
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/65e55b83-c5eb-4415-bac8-4ecaf5fd0446%40isocpp.org.
------=_Part_80_1109978460.1513436482066
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Wednesday, December 13, 2017 at 10:09:41 PM UTC-5, Ming=
xin Wang wrote:<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 Thursday, December 14, 2017 at 4:45:07 AM UTC+8, <a>adrian....@gmail.c=
om</a> wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-lef=
t:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-lef=
t:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>Some time ago I pa=
rticipate in discussion of similar feature. One difference was that was usi=
ng `using` keyword to introduce unknown type of template parameters. I thin=
k use in this context will be consisting with rest of language because you =
can `using` not only types but function too.<br></div></div></blockquote><d=
iv><br></div><div>Well, I think <font face=3D"courier new, monospace">using=
</font>is better keyword to use than the bare <font face=3D"courier new, m=
onospace">template </font>keyword IMHO.=C2=A0 =C2=A0When I see <font face=
=3D"courier new, monospace">template</font>, I just expect to see a templat=
e there, not any TPT.=C2=A0 Other alternatives I considered were <font face=
=3D"courier new, monospace">auto</font>, as it would automatically match an=
y TPT, but that is currently in use now, and <font face=3D"courier new, mon=
ospace">*</font><font face=3D"arial, sans-serif"> (asterix)</font>, which i=
s like a glob that matches everything.=C2=A0 The use of no keyword was a fa=
irly obvious mnemonic, I didn't specify what TPT, so allow any TPT.</di=
v><div><br></div><div>Quite honestly, I don't really mind any of these =
alternatives, but I think that we should not be limited like we are now.=C2=
=A0 This feature is a long time coming and should be added to the language.=
</div><div><br></div><div>What other differences were there in the other di=
scussion you had?=C2=A0 What reason was given to blockade this type of feat=
ure?</div></div></blockquote><div><br></div><div>I think "allowing any=
parameter in a template" is a common demand, especially in compile-ti=
me programming.</div><div><br></div><div>With the standard we have now, one=
is always required to specify the types of the parameters declared in a te=
mplate. In order to define the semantics of the template explicitly, the cl=
ass template `std::integral_constant` was introduced, so that users are abl=
e to pass any integral constants with the template.=C2=A0However, I think `=
integral_constant` is inappropriately named, and there seem to be little ne=
cessity in defining any member types or constants in it, because these meta=
data is already passed by templates.</div><div><br></div><div>In order to s=
tandardize the expressions to pass various sort of metadata to templates, t=
he class templates `in_place_arg_t` and `in_place_resource_t` were proposed=
in one of my earlier posts (<a href=3D"https://groups.google.com/a/isocpp.=
org/forum/#!topic/std-proposals/Gb3CFKiGLfo" target=3D"_blank" rel=3D"nofol=
low" onmousedown=3D"this.href=3D'https://groups.google.com/a/isocpp.org=
/forum/#!topic/std-proposals/Gb3CFKiGLfo';return true;" onclick=3D"this=
..href=3D'https://groups.google.com/a/isocpp.org/forum/#!topic/std-propo=
sals/Gb3CFKiGLfo';return true;">https://groups.google.com/a/<wbr>isocpp=
..org/forum/#!topic/std-<wbr>proposals/Gb3CFKiGLfo</a>) and in my recent pro=
posal p0801 (<a href=3D"http://www.open-std.org/jtc1/sc22/wg21/docs/papers/=
2017/p0801r0.pdf" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.hr=
ef=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.open-std.org%2Fjt=
c1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2017%2Fp0801r0.pdf\x26sa\x3dD\x26sntz\x3=
d1\x26usg\x3dAFQjCNHUBA6lny0Om6vqELlmXbyHKDdCdQ';return true;" onclick=
=3D"this.href=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.open-s=
td.org%2Fjtc1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2017%2Fp0801r0.pdf\x26sa\x3dD=
\x26sntz\x3d1\x26usg\x3dAFQjCNHUBA6lny0Om6vqELlmXbyHKDdCdQ';return true=
;">http://www.open-std.org/jtc1/<wbr>sc22/wg21/docs/papers/2017/<wbr>p0801r=
0.pdf</a>).</div><div><br></div><div>What do you think of my solution? I am=
looking forward to your comments and suggestions.<br></div><div><br></div>=
<div>Mingxin Wang</div></div></blockquote><div><br></div><div>Although your=
proposal is interesting, I don't see how it relates to this thread.</d=
iv><div><br></div><div>This thread isn't about how we can encapsulate a=
n type (if that is what you are getting at, which doesn't seem to be th=
e case as you can't encapsulate templates in that manner).=C2=A0 This i=
s about being able to accept and manipulate any TPT, thus allowing more gen=
eral transforms of any template.=C2=A0 My <font face=3D"courier new, monosp=
ace">tbind </font>example above is a real world example of this.=C2=A0</div=
></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/65e55b83-c5eb-4415-bac8-4ecaf5fd0446%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/65e55b83-c5eb-4415-bac8-4ecaf5fd0446=
%40isocpp.org</a>.<br />
------=_Part_80_1109978460.1513436482066--
------=_Part_79_891027830.1513436482066--
.
Author: Mingxin Wang <wmx16835vv@163.com>
Date: Sun, 17 Dec 2017 01:12:54 -0800 (PST)
Raw View
------=_Part_10304_1284720221.1513501974581
Content-Type: multipart/alternative;
boundary="----=_Part_10305_111815288.1513501974581"
------=_Part_10305_111815288.1513501974581
Content-Type: text/plain; charset="UTF-8"
On Saturday, December 16, 2017 at 11:01:22 PM UTC+8, adrian....@gmail.com
wrote:
>
>
> Although your proposal is interesting, I don't see how it relates to this
> thread.
>
> This thread isn't about how we can encapsulate an type (if that is what
> you are getting at, which doesn't seem to be the case as you can't
> encapsulate templates in that manner). This is about being able to accept
> and manipulate any TPT, thus allowing more general transforms of any
> template. My tbind example above is a real world example of this.
>
I am sorry that I did not get your idea at the beginning. If my
understanding is correct this time, your intension is to popularize the
term "overloading" to type templates.
I think it is worth trying. Overloading is a technique that allows one to
name different "reusable functional units" having similar semantics with a
same identifier. Popularizing this term to templates seems natural, and we
already have partial support of it, e.g. `template <typename...>` and
`template <typename T, T I>`.
However, some details might need to be taken into account before
standardization.
1. Is the motivation strong enough to define a new language feature?
There is partial support of "template overloading" in the standard, and
"overloading" is not inevitable. After all, any case that could be solved
by overloading, could be easily handled with renaming.
2. If we have "template overloading", do we still need "template
specialization"?
"template specialization" is a widely used technique, and it seems that
"template overloading" has some overlap with "template specialization". If
there is enough motivation to keep both features for type templates, is it
necessary to let function templates support "template specialization"?
Otherwise, do we still need "template specialization"?
Mingxin Wang
--
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/b9087d33-6a6e-403a-929d-57d0ed3c1211%40isocpp.org.
------=_Part_10305_111815288.1513501974581
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Saturday, December 16, 2017 at 11:01:22 PM UTC+8, adria=
n....@gmail.com wrote:<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"><div><br></div><div>Although your proposal is interesting, I don&#=
39;t see how it relates to this thread.</div><div><br></div><div>This threa=
d isn't about how we can encapsulate an type (if that is what you are g=
etting at, which doesn't seem to be the case as you can't encapsula=
te templates in that manner).=C2=A0 This is about being able to accept and =
manipulate any TPT, thus allowing more general transforms of any template.=
=C2=A0 My <font face=3D"courier new, monospace">tbind </font>example above =
is a real world example of this.=C2=A0</div></div></blockquote><div><br></d=
iv><div>I am sorry that I did not get your idea at the beginning.=C2=A0If m=
y understanding is correct this time, your intension is to popularize the t=
erm "overloading" to type templates.</div><div><br></div><div>I t=
hink it is worth trying. Overloading is a technique that allows one to name=
different "reusable functional units" having similar semantics w=
ith a same identifier. Popularizing this term to templates seems natural, a=
nd we already have partial support of it, e.g. `template <typename...>=
;` and `template <typename T, T I>`.</div><div><br></div><div>However=
, some details might need to be taken into account before standardization.<=
/div><div><br></div><div>1. Is the motivation strong enough to define a new=
language feature?</div><div><br></div><div>There is partial support of &qu=
ot;template overloading" in the standard, and "overloading" =
is not inevitable. After all, any case that could be solved by overloading,=
could be easily handled with renaming.</div><div><br></div><div>2. If we h=
ave "template overloading", do we still need "template speci=
alization"?</div><div><br></div><div>"template specialization&quo=
t; is a widely used=C2=A0technique, and it seems that "template overlo=
ading" has some overlap with "template specialization". If t=
here is enough motivation to keep both features for type templates, is it n=
ecessary to let function templates support "template specialization&qu=
ot;? Otherwise, do we still need "template specialization"?<br></=
div><div><br></div><div>Mingxin Wang</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/b9087d33-6a6e-403a-929d-57d0ed3c1211%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/b9087d33-6a6e-403a-929d-57d0ed3c1211=
%40isocpp.org</a>.<br />
------=_Part_10305_111815288.1513501974581--
------=_Part_10304_1284720221.1513501974581--
.
Author: adrian.hawryluk@gmail.com
Date: Sun, 17 Dec 2017 19:06:20 -0800 (PST)
Raw View
------=_Part_168_115680241.1513566380442
Content-Type: multipart/alternative;
boundary="----=_Part_169_1374380053.1513566380443"
------=_Part_169_1374380053.1513566380443
Content-Type: text/plain; charset="UTF-8"
On Sunday, December 17, 2017 at 4:12:54 AM UTC-5, Mingxin Wang wrote:
>
> On Saturday, December 16, 2017 at 11:01:22 PM UTC+8, adrian....@gmail.com
> wrote:
>>
>>
>> Although your proposal is interesting, I don't see how it relates to this
>> thread.
>>
>> This thread isn't about how we can encapsulate an type (if that is what
>> you are getting at, which doesn't seem to be the case as you can't
>> encapsulate templates in that manner). This is about being able to accept
>> and manipulate any TPT, thus allowing more general transforms of any
>> template. My tbind example above is a real world example of this.
>>
>
> I am sorry that I did not get your idea at the beginning. If my
> understanding is correct this time, your intension is to popularize the
> term "overloading" to type templates.
>
No, not overloading. This is template specialization, with all the same
rules that that entails. It would be considered the least specialized when
matching specializations. Please see my example above for a more detailed
use case. However, you can see this work in the following minimal example:
// Template declaration
template <T>
struct X;
// Specialization 1
template <auto C>
struct X<C>
{
// C is a template constant
};
// Specialization 1a
template <typename T, T C>
struct X<C>
{
// C is a template constant (same as above)
// T is the type of the constant
// This specialization cannot exist in tandem with the one above
// (Specialization 1) as they are equivalent and would cause an ambiguity
// error.
};
// Specialization 2
template <typename T>
struct X<T>
{
// T is a typename
};
// Specialization 3
template <template <...> class TT>
struct X<TT>
{
// TT is a template that takes any number of UTPT.
};
// Specialization 3a
template <template <auto...> class TT>
struct X<TT>
{
// TT is a template that takes any number of constant TPTs.
};
// Specialization 3b
template <template <typename...> class TT>
struct X<TT>
{
// TT is a template that takes any number of typename TPTs.
};
// Specialization 3c
template <template <template <...> class...> class TT>
struct X<TT>
{
// TT is a template that takes any number of template TPTs that take any
// number of UTPTs.
};
// Specialization 3d
template <template <template <...> class, typename, int> class TT>
struct X<TT>
{
// TT is a template that takes a template that takes any number of UTPTs
and
// a typename and an int constant.
};
The list can go on and on.
> However, some details might need to be taken into account before
> standardization.
>
> 1. Is the motivation strong enough to define a new language feature?
>
> There is partial support of "template overloading" in the standard, and
> "overloading" is not inevitable. After all, any case that could be solved
> by overloading, could be easily handled with renaming.
>
We are not defining a new feature exactly, but extending an already
existing one (template specialization) such that the template parameter
type (TPT) can be unspecified.
2. If we have "template overloading", do we still need "template
> specialization"?
>
> "template specialization" is a widely used technique, and it seems that
> "template overloading" has some overlap with "template specialization". If
> there is enough motivation to keep both features for type templates, is it
> necessary to let function templates support "template specialization"?
> Otherwise, do we still need "template specialization"?
>
Again, this *is* template specialization not template overloading. If we
attempted to add template overloading (if I understand your concept of it),
it would require a lot of vetting as it would be a large departure from
what the language supports now. What I am talking about is a tweak of the
current system which is far less risky.
--
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/baf4ee7a-d885-4c70-8d8b-d4efb1e983de%40isocpp.org.
------=_Part_169_1374380053.1513566380443
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Sunday, December 17, 2017 at 4:12:54 AM UTC-5, =
Mingxin Wang wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;mar=
gin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D=
"ltr">On Saturday, December 16, 2017 at 11:01:22 PM UTC+8, <a>adrian....@gm=
ail.com</a> wrote:<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"ltr">=
<div><br></div><div>Although your proposal is interesting, I don't see =
how it relates to this thread.</div><div><br></div><div>This thread isn'=
;t about how we can encapsulate an type (if that is what you are getting at=
, which doesn't seem to be the case as you can't encapsulate templa=
tes in that manner).=C2=A0 This is about being able to accept and manipulat=
e any TPT, thus allowing more general transforms of any template.=C2=A0 My =
<font face=3D"courier new, monospace">tbind </font>example above is a real =
world example of this.=C2=A0</div></div></blockquote><div><br></div><div>I =
am sorry that I did not get your idea at the beginning.=C2=A0If my understa=
nding is correct this time, your intension is to popularize the term "=
overloading" to type templates.</div></div></blockquote><div><br></div=
><div>No, not overloading.=C2=A0 This is template specialization, with all =
the same rules that that entails.=C2=A0 It would be considered the least sp=
ecialized when matching specializations.=C2=A0 Please see my example above =
for a more detailed use case.=C2=A0 However, you can see this work in the f=
ollowing minimal example:</div><div><br></div><div><div class=3D"prettyprin=
t" style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 18=
7, 187); border-style: solid; border-width: 1px; word-wrap: break-word;"><c=
ode class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"colo=
r: #800;" class=3D"styled-by-prettify">// Template declaration</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br></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;" class=3D"styled-by-prettify"><</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"st=
yled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">struct</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> X</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br><=
br></span><span style=3D"color: #800;" class=3D"styled-by-prettify">// Spec=
ialization 1</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">temp=
late</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">auto</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> C</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">></span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> X</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify"><</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">C</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><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span><s=
pan style=3D"color: #800;" class=3D"styled-by-prettify">// C is a template =
constant</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r></span><span style=3D"color: #660;" class=3D"styled-by-prettify">};</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br><br></sp=
an><span style=3D"color: #800;" class=3D"styled-by-prettify">// Specializat=
ion 1a</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">template</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span styl=
e=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"colo=
r: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"> T C</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">></span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">struct</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> X</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
<</span><span style=3D"color: #000;" class=3D"styled-by-prettify">C</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">></span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span><span style=3D"col=
or: #800;" class=3D"styled-by-prettify">// C is a template constant (same a=
s above)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r>=C2=A0 </span><span style=3D"color: #800;" class=3D"styled-by-prettify">/=
/ T is the type of the constant</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"><br>=C2=A0 </span><span style=3D"color: #800;" class=
=3D"styled-by-prettify">// This specialization cannot exist in tandem with =
the one above</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br>=C2=A0 </span><span style=3D"color: #800;" class=3D"styled-by-pretti=
fy">// (Specialization 1) as they are equivalent and would cause an ambigui=
ty</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=
=A0 </span><span style=3D"color: #800;" class=3D"styled-by-prettify">// err=
or.</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">};</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br><br><br></span><s=
pan style=3D"color: #800;" class=3D"styled-by-prettify">// Specialization 2=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></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 styl=
e=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">></span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">struct</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> X</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify"><</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
">T</span><span style=3D"color: #660;" class=3D"styled-by-prettify">></s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span><span styl=
e=3D"color: #800;" class=3D"styled-by-prettify">// T is a typename</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">};</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br><br><br></span><span style=3D=
"color: #800;" class=3D"styled-by-prettify">// Specialization 3</span><span=
style=3D"color: #000;" class=3D"styled-by-prettify"><br></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;" class=3D"styled-by-prettify"><</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;" class=3D=
"styled-by-prettify"><...></span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">class</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> TT</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">></span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
></span><span style=3D"color: #008;" class=3D"styled-by-prettify">struct</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> X</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">TT</span><span style=3D"col=
or: #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><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br>=C2=A0 </span><span style=3D"color: #800;" class=3D"=
styled-by-prettify">// TT is a template that takes any number of UTPT.</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">};</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br><br><br></span><span sty=
le=3D"color: #800;" class=3D"styled-by-prettify">// Specialization 3a</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span=
style=3D"color: #008;" class=3D"styled-by-prettify">template</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color: =
#008;" class=3D"styled-by-prettify">template</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: #008;" class=3D"s=
tyled-by-prettify">auto</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"=
>class</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> TT<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">></span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span =
style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> X</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify">TT</span><span style=3D"color: #660;" cla=
ss=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-prett=
ify"><br>=C2=A0 </span><span style=3D"color: #800;" class=3D"styled-by-pret=
tify">// TT is a template that takes any number of constant TPTs.</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"co=
lor: #000;" class=3D"styled-by-prettify"><br><br><br></span><span style=3D"=
color: #800;" class=3D"styled-by-prettify">// Specialization 3b</span><span=
style=3D"color: #000;" class=3D"styled-by-prettify"><br></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;" class=3D"styled-by-prettify"><</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;" class=3D=
"styled-by-prettify"><</span><span style=3D"color: #008;" class=3D"style=
d-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"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>class</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> TT<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">></span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span =
style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> X</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify">TT</span><span style=3D"color: #660;" cla=
ss=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-prett=
ify"><br>=C2=A0 </span><span style=3D"color: #800;" class=3D"styled-by-pret=
tify">// TT is a template that takes any number of typename TPTs.</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"co=
lor: #000;" class=3D"styled-by-prettify"><br><br><br></span><span style=3D"=
color: #800;" class=3D"styled-by-prettify">// Specialization 3c</span><span=
style=3D"color: #000;" class=3D"styled-by-prettify"><br></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;" class=3D"styled-by-prettify"><</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;" class=3D=
"styled-by-prettify"><</span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">template</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy"><...></span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">clas=
s</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: #008;" class=3D"styled-by-prettify">class</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> TT</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">></span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;"=
class=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> X</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify"><</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">TT</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">></span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r></span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span=
><span style=3D"color: #800;" class=3D"styled-by-prettify">// TT is a templ=
ate that takes any number of template TPTs that take any</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span><span styl=
e=3D"color: #800;" class=3D"styled-by-prettify">// number of UTPTs.</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"=
color: #000;" class=3D"styled-by-prettify"><br><br><br></span><span style=
=3D"color: #800;" class=3D"styled-by-prettify">// Specialization 3d</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">template</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: #0=
08;" 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"><</span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">template</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-pr=
ettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">c=
lass</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">typename</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: #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"st=
yled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">class</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> TT</span><span style=3D"color: #660;" class=3D"styled-by-prettify">>=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></spa=
n><span style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> X</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">TT</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">></span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br>=C2=A0 </span><span style=3D"color: #800;" class=3D"styl=
ed-by-prettify">// TT is a template that takes a template that takes any nu=
mber of UTPTs and</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br>=C2=A0 </span><span style=3D"color: #800;" class=3D"styled-by-pr=
ettify">// a typename and an int constant.</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">};</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br><br></span></div></code></div><div><br>The list can g=
o on and on.</div></div><div>=C2=A0</div><blockquote class=3D"gmail_quote" =
style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-l=
eft: 1ex;"><div dir=3D"ltr"><div>However, some details might need to be tak=
en into account before standardization.<br></div><div><br></div><div>1. Is =
the motivation strong enough to define a new language feature?</div><div><b=
r></div><div>There is partial support of "template overloading" i=
n the standard, and "overloading" is not inevitable. After all, a=
ny case that could be solved by overloading, could be easily handled with r=
enaming.</div></div></blockquote><div><br></div><div>We are not defining a =
new feature=C2=A0 exactly, but extending an already existing one (template =
specialization) such that the template parameter type (TPT) can be unspecif=
ied.=C2=A0</div><div><br></div><blockquote class=3D"gmail_quote" style=3D"m=
argin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"=
><div dir=3D"ltr"><div>2. If we have "template overloading", do w=
e still need "template specialization"?</div><div><br></div><div>=
"template specialization" is a widely used=C2=A0technique, and it=
seems that "template overloading" has some overlap with "te=
mplate specialization". If there is enough motivation to keep both fea=
tures for type templates, is it necessary to let function templates support=
"template specialization"? Otherwise, do we still need "tem=
plate specialization"?<br></div></div></blockquote><div><br></div><div=
>Again, this <i>is</i> template specialization not template overloading.=C2=
=A0 If we attempted to add template overloading (if I understand your conce=
pt of it), it would require a lot of vetting as it would be a large departu=
re from what the language supports now.=C2=A0 What I am talking about is a =
tweak of the current system which is far less risky.</div><div><br></div><d=
iv><br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/baf4ee7a-d885-4c70-8d8b-d4efb1e983de%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/baf4ee7a-d885-4c70-8d8b-d4efb1e983de=
%40isocpp.org</a>.<br />
------=_Part_169_1374380053.1513566380443--
------=_Part_168_115680241.1513566380442--
.
Author: adrian.hawryluk@gmail.com
Date: Sun, 17 Dec 2017 21:08:34 -0800 (PST)
Raw View
------=_Part_6229_1928068994.1513573714539
Content-Type: multipart/alternative;
boundary="----=_Part_6230_1263072680.1513573714540"
------=_Part_6230_1263072680.1513573714540
Content-Type: text/plain; charset="UTF-8"
Oh, and if we used the template keyword as was suggested by Nicol, it would
be alternate would be
// Template declaration
template <template T>
struct X;
// Specialization 1
template <auto C>
struct X<C>
{
// C is a template constant
};
// Specialization 1a
template <typename T, T C>
struct X<C>
{
// C is a template constant (same as above)
// T is the type of the constant
// This specialization cannot exist in tandem with the one above
// (Specialization 1) as they are equivalent and would cause an ambiguity
// error.
};
// Specialization 2
template <typename T>
struct X<T>
{
// T is a typename
};
// Specialization 3
template <template <template...> class TT>
struct X<TT>
{
// TT is a template that takes any number of UTPT.
};
// Specialization 3a
template <template <auto...> class TT>
struct X<TT>
{
// TT is a template that takes any number of constant TPTs.
};
// Specialization 3b
template <template <typename...> class TT>
struct X<TT>
{
// TT is a template that takes any number of typename TPTs.
};
// Specialization 3c
template <template <template <template...> class...> class TT>
struct X<TT>
{
// TT is a template that takes any number of template TPTs that take any
// number of UTPTs.
};
// Specialization 3d
template <template <template <template...> class, typename, int> class TT>
struct X<TT>
{
// TT is a template that takes a template that takes any number of UTPTs
and
// a typename and an int constant.
};
However, I still don't like the use of the keyword template in this as I
personally find it more confusing to the reader. Using no keyword or
perhaps another keyword would prolly be better.
--
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/a649caed-0206-4f11-80d4-b3feb5cdf1e2%40isocpp.org.
------=_Part_6230_1263072680.1513573714540
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>Oh, and if we used the template keyword as was sugges=
ted by Nicol, it would be alternate would be=C2=A0</div><div><br></div><div=
><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); =
border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; w=
ord-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subprettyp=
rint"><span style=3D"color: #800;" class=3D"styled-by-prettify">// Template=
declaration</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">temp=
late</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">template</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-prettify"><br></span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> X</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br><br></span><span style=3D"color: #800;" class=3D"styled-by-p=
rettify">// Specialization 1</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">template</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: #008;" class=3D"styled-by-prettify">auto<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> C</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">></span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D=
"color: #008;" class=3D"styled-by-prettify">struct</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> X</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify"><</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">C</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">></span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br></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 </span><span style=3D"color: #800;" class=3D"styled-by-prettify">// =
C is a template constant</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">};</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br><br></span><span style=3D"color: #800;" class=3D"styled-by-prettify">//=
Specialization 1a</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br></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;" class=3D"styled-by-prettify"><</spa=
n><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 st=
yle=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> T C</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">></span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> X</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify"><</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">C</span><span style=3D"color: #660;" class=3D"styled-by-prettify">>=
;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span><span =
style=3D"color: #800;" class=3D"styled-by-prettify">// C is a template cons=
tant (same as above)</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br>=C2=A0 </span><span style=3D"color: #800;" class=3D"styled-by=
-prettify">// T is the type of the constant</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br>=C2=A0 </span><span style=3D"color: #8=
00;" class=3D"styled-by-prettify">// This specialization cannot exist in ta=
ndem with the one above</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"><br>=C2=A0 </span><span style=3D"color: #800;" class=3D"styled=
-by-prettify">// (Specialization 1) as they are equivalent and would cause =
an ambiguity</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br>=C2=A0 </span><span style=3D"color: #800;" class=3D"styled-by-prettif=
y">// error.</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><br></sp=
an><span style=3D"color: #800;" class=3D"styled-by-prettify">// Specializat=
ion 2</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><=
/span><span style=3D"color: #008;" class=3D"styled-by-prettify">template</s=
pan><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: #008;" class=3D"styled-by-prettify">typename</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> T</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">></span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> X</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify"><</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">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 style=3D"color: #660;" class=3D"styled-by-prettify">{</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span><s=
pan style=3D"color: #800;" class=3D"styled-by-prettify">// T is a typename<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">};</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span styl=
e=3D"color: #800;" class=3D"styled-by-prettify">// Specialization 3</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">template</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: #0=
08;" 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"><</span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">template</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">...></span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">class</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
TT</span><span style=3D"color: #660;" class=3D"styled-by-prettify">></sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> X</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color:=
#000;" class=3D"styled-by-prettify">TT</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"st=
yled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br>=C2=A0 </span><span style=3D"color: #800;" class=3D"styled-by-=
prettify">// TT is a template that takes any number of UTPT.</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">};</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #8=
00;" class=3D"styled-by-prettify">// Specialization 3a</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br></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;" cl=
ass=3D"styled-by-prettify"><</span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">template</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-=
prettify"><</span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">auto</span><span style=3D"color: #660;" class=3D"styled-by-prettify">..=
..></span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">class</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> TT</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">></span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color:=
#008;" class=3D"styled-by-prettify">struct</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> X</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify"><</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">TT</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">></span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"><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=
</span><span style=3D"color: #800;" class=3D"styled-by-prettify">// TT is =
a template that takes any number of constant TPTs.</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">};</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br><br></span><span style=3D"color: #800;" class=
=3D"styled-by-prettify">// Specialization 3b</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">template</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify"><</span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">template</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: #008;" class=3D"styled-by-prettify">typena=
me</span><span style=3D"color: #660;" class=3D"styled-by-prettify">...><=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">class</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> TT</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">></span><span style=3D"color:=
#000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> X</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify"><</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify">TT</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">></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 </spa=
n><span style=3D"color: #800;" class=3D"styled-by-prettify">// TT is a temp=
late that takes any number of typename TPTs.</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><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br><br></span><span style=3D"color: #800;" class=3D"st=
yled-by-prettify">// Specialization 3c</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br></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;" class=3D"style=
d-by-prettify"><</span><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">template=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">template</span><span styl=
e=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: #66=
0;" 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: #000;" class=3D"styl=
ed-by-prettify"> TT</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">></span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">str=
uct</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> X</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">TT</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">></span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br>=C2=A0 </span><span style=3D"color: #800;" cl=
ass=3D"styled-by-prettify">// TT is a template that takes any number of tem=
plate TPTs that take any</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"><br>=C2=A0 </span><span style=3D"color: #800;" class=3D"style=
d-by-prettify">// number of UTPTs.</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">};</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br><br></span><span style=3D"color: #800;" class=3D"styled-by-pr=
ettify">// Specialization 3d</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">template</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: #008;" class=3D"styled-by-prettify">templ=
ate</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: #008;" class=3D"styled-by-prettify">template</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color: =
#008;" class=3D"styled-by-prettify">template</span><span style=3D"color: #6=
60;" 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: #660;" class=3D"s=
tyled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #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"> </span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span sty=
le=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=
08;" class=3D"styled-by-prettify">class</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> TT</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">></span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">struct</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> X</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
<</span><span style=3D"color: #000;" class=3D"styled-by-prettify">TT</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">></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 </span><span style=3D"co=
lor: #800;" class=3D"styled-by-prettify">// TT is a template that takes a t=
emplate that takes any number of UTPTs and</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"><br>=C2=A0 </span><span style=3D"color: #80=
0;" class=3D"styled-by-prettify">// a typename and an int constant.</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></div></code></=
div><div><br></div></div><div>However, I still don't like the use of th=
e keyword template in this as I personally find it more confusing to the re=
ader.=C2=A0 Using no keyword or perhaps another keyword would prolly be bet=
ter.</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/a649caed-0206-4f11-80d4-b3feb5cdf1e2%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/a649caed-0206-4f11-80d4-b3feb5cdf1e2=
%40isocpp.org</a>.<br />
------=_Part_6230_1263072680.1513573714540--
------=_Part_6229_1928068994.1513573714539--
.
Author: Mingxin Wang <wmx16835vv@163.com>
Date: Sun, 17 Dec 2017 22:10:53 -0800 (PST)
Raw View
------=_Part_16807_1698059148.1513577453484
Content-Type: multipart/alternative;
boundary="----=_Part_16808_1371120055.1513577453485"
------=_Part_16808_1371120055.1513577453485
Content-Type: text/plain; charset="UTF-8"
On Monday, December 18, 2017 at 11:06:20 AM UTC+8, adrian....@gmail.com
wrote:
>
> I am sorry that I did not get your idea at the beginning. If my
>> understanding is correct this time, your intension is to popularize the
>> term "overloading" to type templates.
>>
>
> No, not overloading. This is template specialization, with all the same
> rules that that entails. It would be considered the least specialized when
> matching specializations. Please see my example above for a more detailed
> use case. However, you can see this work in the following minimal example:
>
> // Template declaration
> template <T>
> struct X;
>
>
> // Specialization 1
> template <auto C>
> struct X<C>
> {
> // C is a template constant
> };
>
>
> // Specialization 1a
> template <typename T, T C>
> struct X<C>
> {
> // C is a template constant (same as above)
> // T is the type of the constant
> // This specialization cannot exist in tandem with the one above
> // (Specialization 1) as they are equivalent and would cause an
> ambiguity
> // error.
> };
>
>
> // Specialization 2
> template <typename T>
> struct X<T>
> {
> // T is a typename
> };
>
>
> // Specialization 3
> template <template <...> class TT>
> struct X<TT>
> {
> // TT is a template that takes any number of UTPT.
> };
>
>
> // Specialization 3a
> template <template <auto...> class TT>
> struct X<TT>
> {
> // TT is a template that takes any number of constant TPTs.
> };
>
>
> // Specialization 3b
> template <template <typename...> class TT>
> struct X<TT>
> {
> // TT is a template that takes any number of typename TPTs.
> };
>
>
> // Specialization 3c
> template <template <template <...> class...> class TT>
> struct X<TT>
> {
> // TT is a template that takes any number of template TPTs that take any
> // number of UTPTs.
> };
>
>
> // Specialization 3d
> template <template <template <...> class, typename, int> class TT>
> struct X<TT>
> {
> // TT is a template that takes a template that takes any number of
> UTPTs and
> // a typename and an int constant.
> };
>
>
> The list can go on and on.
>
It seems that you are proposing a core language feature that allows one to
pass ANYTHING (types, type templates, constexpr values, etc.) on template
instantiation.
I think the motivation of this idea is not strong enough to a certain
extent, because:
1. Types, type templates and constexpr values usually have *completely*
different semantics. Thus using this feature will inevitably carry
ambiguation to the semantics of the templates. For example, if one is
supposed to define some types like `X<int>` (type), `X<123>` (constexpr
value) and `X<std::vector>` (type template), I do not agree that the three
types shall have the same semantics, thus they shall have different names
for their respective semantics, rather than sharing a same one.
2. Any case that could be solved by this feature, could *also* be easily
handled with renaming.
3. Although you are "extending an already existing feature", it is still a
core language feature that requires support from the compiler.
However, some details might need to be taken into account before
>> standardization.
>>
>> 1. Is the motivation strong enough to define a new language feature?
>>
>> There is partial support of "template overloading" in the standard, and
>> "overloading" is not inevitable. After all, any case that could be solved
>> by overloading, could be easily handled with renaming.
>>
>
> We are not defining a new feature exactly, but extending an already
> existing one (template specialization) such that the template parameter
> type (TPT) can be unspecified.
>
> 2. If we have "template overloading", do we still need "template
>> specialization"?
>>
>> "template specialization" is a widely used technique, and it seems that
>> "template overloading" has some overlap with "template specialization". If
>> there is enough motivation to keep both features for type templates, is it
>> necessary to let function templates support "template specialization"?
>> Otherwise, do we still need "template specialization"?
>>
>
> Again, this *is* template specialization not template overloading. If we
> attempted to add template overloading (if I understand your concept of it),
> it would require a lot of vetting as it would be a large departure from
> what the language supports now. What I am talking about is a tweak of the
> current system which is far less risky.
>
Actually, I think "template overloading" might be more acceptible than the
feature you propose; at least, it does not break the existing rules in
declaring a template, and does not require new keywords (or reuse some
existing keywords) with new semantics.
Mingxin Wang
--
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/0a8cf066-fa60-4273-8450-94c59c957779%40isocpp.org.
------=_Part_16808_1371120055.1513577453485
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br>On Monday, December 18, 2017 at 11:06:20 AM UTC+8, adr=
ian....@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: =
0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div d=
ir=3D"ltr"><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"><div>I =
am sorry that I did not get your idea at the beginning.=C2=A0If my understa=
nding is correct this time, your intension is to popularize the term "=
overloading" to type templates.</div></div></blockquote><div><br></div=
><div>No, not overloading.=C2=A0 This is template specialization, with all =
the same rules that that entails.=C2=A0 It would be considered the least sp=
ecialized when matching specializations.=C2=A0 Please see my example above =
for a more detailed use case.=C2=A0 However, you can see this work in the f=
ollowing minimal example:</div><div><br></div><div><div style=3D"background=
-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;bo=
rder-width:1px;word-wrap:break-word"><code><div><span style=3D"color:#800">=
// Template declaration</span><span style=3D"color:#000"><br></span><span s=
tyle=3D"color:#008">template</span><span style=3D"color:#000"> </span><span=
style=3D"color:#660"><</span><span style=3D"color:#000">T</span><span s=
tyle=3D"color:#660">></span><span style=3D"color:#000"><br></span><span =
style=3D"color:#008">struct</span><span style=3D"color:#000"> X</span><span=
style=3D"color:#660">;</span><span style=3D"color:#000"><br><br><br></span=
><span style=3D"color:#800">// Specialization 1</span><span style=3D"color:=
#000"><br></span><span style=3D"color:#008">template</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#660"><</span><span style=3D"col=
or:#008">auto</span><span style=3D"color:#000"> C</span><span style=3D"colo=
r:#660">></span><span style=3D"color:#000"><br></span><span style=3D"col=
or:#008">struct</span><span style=3D"color:#000"> X</span><span style=3D"co=
lor:#660"><</span><span style=3D"color:#000">C</span><span style=3D"colo=
r:#660">></span><span style=3D"color:#000"><br></span><span style=3D"col=
or:#660">{</span><span style=3D"color:#000"><br>=C2=A0 </span><span style=
=3D"color:#800">// C is a template constant</span><span style=3D"color:#000=
"><br></span><span style=3D"color:#660">};</span><span style=3D"color:#000"=
><br><br><br></span><span style=3D"color:#800">// Specialization 1a</span><=
span style=3D"color:#000"><br></span><span style=3D"color:#008">template</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#660"><</spa=
n><span style=3D"color:#008">typename</span><span style=3D"color:#000"> T</=
span><span style=3D"color:#660">,</span><span style=3D"color:#000"> T C</sp=
an><span style=3D"color:#660">></span><span style=3D"color:#000"><br></s=
pan><span style=3D"color:#008">struct</span><span style=3D"color:#000"> X</=
span><span style=3D"color:#660"><</span><span style=3D"color:#000">C</sp=
an><span style=3D"color:#660">></span><span style=3D"color:#000"><br></s=
pan><span style=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=
=A0 </span><span style=3D"color:#800">// C is a template constant (same as =
above)</span><span style=3D"color:#000"><br>=C2=A0 </span><span style=3D"co=
lor:#800">// T is the type of the constant</span><span style=3D"color:#000"=
><br>=C2=A0 </span><span style=3D"color:#800">// This specialization cannot=
exist in tandem with the one above</span><span style=3D"color:#000"><br>=
=C2=A0 </span><span style=3D"color:#800">// (Specialization 1) as they are =
equivalent and would cause an ambiguity</span><span style=3D"color:#000"><b=
r>=C2=A0 </span><span style=3D"color:#800">// error.</span><span style=3D"c=
olor:#000"><br></span><span style=3D"color:#660">};</span><span style=3D"co=
lor:#000"><br><br><br></span><span style=3D"color:#800">// Specialization 2=
</span><span style=3D"color:#000"><br></span><span style=3D"color:#008">tem=
plate</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:#0=
00"> T</span><span style=3D"color:#660">></span><span style=3D"color:#00=
0"><br></span><span style=3D"color:#008">struct</span><span style=3D"color:=
#000"> X</span><span style=3D"color:#660"><</span><span style=3D"color:#=
000">T</span><span style=3D"color:#660">></span><span style=3D"color:#00=
0"><br></span><span style=3D"color:#660">{</span><span style=3D"color:#000"=
><br>=C2=A0 </span><span style=3D"color:#800">// T is a typename</span><spa=
n style=3D"color:#000"><br></span><span style=3D"color:#660">};</span><span=
style=3D"color:#000"><br><br><br></span><span style=3D"color:#800">// Spec=
ialization 3</span><span style=3D"color:#000"><br></span><span style=3D"col=
or:#008">template</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#660"><</span><span style=3D"color:#008">template</span><span style=
=3D"color:#000"> </span><span style=3D"color:#660"><...></span><span =
style=3D"color:#000"> </span><span style=3D"color:#008">class</span><span s=
tyle=3D"color:#000"> TT</span><span style=3D"color:#660">></span><span s=
tyle=3D"color:#000"><br></span><span style=3D"color:#008">struct</span><spa=
n style=3D"color:#000"> X</span><span style=3D"color:#660"><</span><span=
style=3D"color:#000">TT</span><span style=3D"color:#660">></span><span =
style=3D"color:#000"><br></span><span style=3D"color:#660">{</span><span st=
yle=3D"color:#000"><br>=C2=A0 </span><span style=3D"color:#800">// TT is a =
template that takes any number of UTPT.</span><span style=3D"color:#000"><b=
r></span><span style=3D"color:#660">};</span><span style=3D"color:#000"><br=
><br><br></span><span style=3D"color:#800">// Specialization 3a</span><span=
style=3D"color:#000"><br></span><span style=3D"color:#008">template</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#660"><</span><s=
pan style=3D"color:#008">template</span><span style=3D"color:#000"> </span>=
<span style=3D"color:#660"><</span><span style=3D"color:#008">auto</span=
><span style=3D"color:#660">...></span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#008">class</span><span style=3D"color:#000"> TT</sp=
an><span style=3D"color:#660">></span><span style=3D"color:#000"><br></s=
pan><span style=3D"color:#008">struct</span><span style=3D"color:#000"> X</=
span><span style=3D"color:#660"><</span><span style=3D"color:#000">TT</s=
pan><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 </span><span style=3D"color:#800">// TT is a template that takes any nu=
mber of constant TPTs.</span><span style=3D"color:#000"><br></span><span st=
yle=3D"color:#660">};</span><span style=3D"color:#000"><br><br><br></span><=
span style=3D"color:#800">// Specialization 3b</span><span style=3D"color:#=
000"><br></span><span style=3D"color:#008">template</span><span style=3D"co=
lor:#000"> </span><span style=3D"color:#660"><</span><span style=3D"colo=
r:#008">template</span><span style=3D"color:#000"> </span><span style=3D"co=
lor:#660"><</span><span style=3D"color:#008">typename</span><span style=
=3D"color:#660">...></span><span style=3D"color:#000"> </span><span styl=
e=3D"color:#008">class</span><span style=3D"color:#000"> TT</span><span sty=
le=3D"color:#660">></span><span style=3D"color:#000"><br></span><span st=
yle=3D"color:#008">struct</span><span style=3D"color:#000"> X</span><span s=
tyle=3D"color:#660"><</span><span style=3D"color:#000">TT</span><span st=
yle=3D"color:#660">></span><span style=3D"color:#000"><br></span><span s=
tyle=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 </span><s=
pan style=3D"color:#800">// TT is a template that takes any number of typen=
ame TPTs.</span><span style=3D"color:#000"><br></span><span style=3D"color:=
#660">};</span><span style=3D"color:#000"><br><br><br></span><span style=3D=
"color:#800">// Specialization 3c</span><span style=3D"color:#000"><br></sp=
an><span style=3D"color:#008">template</span><span style=3D"color:#000"> </=
span><span style=3D"color:#660"><</span><span style=3D"color:#008">templ=
ate</span><span style=3D"color:#000"> </span><span style=3D"color:#660"><=
;</span><span style=3D"color:#008">template</span><span style=3D"color:#000=
"> </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=
:#008">class</span><span style=3D"color:#000"> TT</span><span style=3D"colo=
r:#660">></span><span style=3D"color:#000"><br></span><span style=3D"col=
or:#008">struct</span><span style=3D"color:#000"> X</span><span style=3D"co=
lor:#660"><</span><span style=3D"color:#000">TT</span><span style=3D"col=
or:#660">></span><span style=3D"color:#000"><br></span><span style=3D"co=
lor:#660">{</span><span style=3D"color:#000"><br>=C2=A0 </span><span style=
=3D"color:#800">// TT is a template that takes any number of template TPTs =
that take any</span><span style=3D"color:#000"><br>=C2=A0 </span><span styl=
e=3D"color:#800">// number of UTPTs.</span><span style=3D"color:#000"><br><=
/span><span style=3D"color:#660">};</span><span style=3D"color:#000"><br><b=
r><br></span><span style=3D"color:#800">// Specialization 3d</span><span st=
yle=3D"color:#000"><br></span><span style=3D"color:#008">template</span><sp=
an style=3D"color:#000"> </span><span style=3D"color:#660"><</span><span=
style=3D"color:#008">template</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#660"><</span><span style=3D"color:#008">template</spa=
n><span style=3D"color:#000"> </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:#008">typename</span><span style=3D"color:#660">,</sp=
an><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><s=
pan style=3D"color:#008">class</span><span style=3D"color:#000"> TT</span><=
span style=3D"color:#660">></span><span style=3D"color:#000"><br></span>=
<span style=3D"color:#008">struct</span><span style=3D"color:#000"> X</span=
><span style=3D"color:#660"><</span><span style=3D"color:#000">TT</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 <=
/span><span style=3D"color:#800">// TT is a template that takes a template =
that takes any number of UTPTs and</span><span style=3D"color:#000"><br>=C2=
=A0 </span><span style=3D"color:#800">// a typename and an int constant.</s=
pan><span style=3D"color:#000"><br></span><span style=3D"color:#660">};</sp=
an><span style=3D"color:#000"><br><br></span></div></code></div><div><br>Th=
e list can go on and on.</div></div></div></blockquote><div><br></div><div>=
It seems that you are proposing a core language feature that allows one to =
pass ANYTHING (types, type templates, constexpr values, etc.) on template i=
nstantiation.</div><div><br></div><div>I think the motivation of this idea =
is not strong enough to a certain extent, because:</div><div><br></div><div=
>1. Types, type templates and constexpr values usually have=C2=A0<i>complet=
ely</i> different semantics. Thus using this feature will=C2=A0inevitably=
=C2=A0carry ambiguation to the semantics of the templates. For example, if =
one is supposed to define some types like `X<int>` (type), `X<123&=
gt;` (constexpr value) and `X<std::vector>` (type template), I do not=
agree that the three types shall have the same semantics, thus they shall =
have different names for their respective semantics, rather than sharing a =
same one.</div><div><br></div><div>2. Any case that could be solved by this=
feature, could <i>also</i> be easily handled with renaming.</div><div><br>=
</div><div>3. Although you are "extending an already existing feature&=
quot;, it is still a core language feature that requires support from the c=
ompiler.</div><div><br></div><blockquote class=3D"gmail_quote" style=3D"mar=
gin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><=
div dir=3D"ltr"><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"><d=
iv>However, some details might need to be taken into account before standar=
dization.<br></div><div><br></div><div>1. Is the motivation strong enough t=
o define a new language feature?</div><div><br></div><div>There is partial =
support of "template overloading" in the standard, and "over=
loading" is not inevitable. After all, any case that could be solved b=
y overloading, could be easily handled with renaming.</div></div></blockquo=
te><div><br></div><div>We are not defining a new feature=C2=A0 exactly, but=
extending an already existing one (template specialization) such that the =
template parameter type (TPT) can be unspecified.=C2=A0</div><div><br></div=
><blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;bord=
er-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>2. If we hav=
e "template overloading", do we still need "template special=
ization"?</div><div><br></div><div>"template specialization"=
is a widely used=C2=A0technique, and it seems that "template overload=
ing" has some overlap with "template specialization". If the=
re is enough motivation to keep both features for type templates, is it nec=
essary to let function templates support "template specialization"=
;? Otherwise, do we still need "template specialization"?<br></di=
v></div></blockquote><div><br></div><div>Again, this <i>is</i> template spe=
cialization not template overloading.=C2=A0 If we attempted to add template=
overloading (if I understand your concept of it), it would require a lot o=
f vetting as it would be a large departure from what the language supports =
now.=C2=A0 What I am talking about is a tweak of the current system which i=
s far less risky.</div></div></blockquote><div><br></div><div>Actually, I t=
hink "template overloading" might be more acceptible than the fea=
ture you propose; at least, it does not break the existing rules in declari=
ng a template, and does not require new keywords (or reuse some existing ke=
ywords) with new semantics.</div><div><br></div><div>Mingxin Wang</div></di=
v>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/0a8cf066-fa60-4273-8450-94c59c957779%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/0a8cf066-fa60-4273-8450-94c59c957779=
%40isocpp.org</a>.<br />
------=_Part_16808_1371120055.1513577453485--
------=_Part_16807_1698059148.1513577453484--
.
Author: adrian.hawryluk@gmail.com
Date: Mon, 18 Dec 2017 05:52:04 -0800 (PST)
Raw View
------=_Part_203_278525128.1513605124193
Content-Type: multipart/alternative;
boundary="----=_Part_204_318895569.1513605124194"
------=_Part_204_318895569.1513605124194
Content-Type: text/plain; charset="UTF-8"
On Monday, December 18, 2017 at 1:10:53 AM UTC-5, Mingxin Wang wrote:
>
>
> On Monday, December 18, 2017 at 11:06:20 AM UTC+8, adrian....@gmail.com
> wrote:
>>
>> I am sorry that I did not get your idea at the beginning. If my
>>> understanding is correct this time, your intension is to popularize the
>>> term "overloading" to type templates.
>>>
>>
>> No, not overloading. This is template specialization, with all the same
>> rules that that entails. It would be considered the least specialized when
>> matching specializations. Please see my example above for a more detailed
>> use case. However, you can see this work in the following minimal example:
>>
>> // Template declaration
>> template <T>
>> struct X;
>>
>>
>> // Specialization 1
>> template <auto C>
>> struct X<C>
>> {
>> // C is a template constant
>> };
>>
>>
>> // Specialization 1a
>> template <typename T, T C>
>> struct X<C>
>> {
>> // C is a template constant (same as above)
>> // T is the type of the constant
>> // This specialization cannot exist in tandem with the one above
>> // (Specialization 1) as they are equivalent and would cause an
>> ambiguity
>> // error.
>> };
>>
>>
>> // Specialization 2
>> template <typename T>
>> struct X<T>
>> {
>> // T is a typename
>> };
>>
>>
>> // Specialization 3
>> template <template <...> class TT>
>> struct X<TT>
>> {
>> // TT is a template that takes any number of UTPT.
>> };
>>
>>
>> // Specialization 3a
>> template <template <auto...> class TT>
>> struct X<TT>
>> {
>> // TT is a template that takes any number of constant TPTs.
>> };
>>
>>
>> // Specialization 3b
>> template <template <typename...> class TT>
>> struct X<TT>
>> {
>> // TT is a template that takes any number of typename TPTs.
>> };
>>
>>
>> // Specialization 3c
>> template <template <template <...> class...> class TT>
>> struct X<TT>
>> {
>> // TT is a template that takes any number of template TPTs that take
>> any
>> // number of UTPTs.
>> };
>>
>>
>> // Specialization 3d
>> template <template <template <...> class, typename, int> class TT>
>> struct X<TT>
>> {
>> // TT is a template that takes a template that takes any number of
>> UTPTs and
>> // a typename and an int constant.
>> };
>>
>>
>> The list can go on and on.
>>
>
> It seems that you are proposing a core language feature that allows one to
> pass ANYTHING (types, type templates, constexpr values, etc.) on template
> instantiation.
>
Yes
> I think the motivation of this idea is not strong enough to a certain
> extent, because:
>
> 1. Types, type templates and constexpr values usually have *completely*
> different semantics. Thus using this feature will inevitably carry
> ambiguation to the semantics of the templates. For example, if one is
> supposed to define some types like `X<int>` (type), `X<123>` (constexpr
> value) and `X<std::vector>` (type template), I do not agree that the three
> types shall have the same semantics, thus they shall have different names
> for their respective semantics, rather than sharing a same one.
>
How does it carry ambiguation to the semantics of templates? Being able to
transform any template list to another or into an object would benefit from
this. If you had ever had to wrap a constant in an integral_constant just
so that it is a type that you can iterate over, then you should be able to
see that that case can be helped with using this proposal.
> 2. Any case that could be solved by this feature, could *also* be easily
> handled with renaming.
>
Have you looked at the tbind example above? This shows that this feature *cannot
*be handled with renaming, easily or otherwise..
> 3. Although you are "extending an already existing feature", it is still a
> core language feature that requires support from the compiler.
>
> However, some details might need to be taken into account before
>>> standardization.
>>>
>>> 1. Is the motivation strong enough to define a new language feature?
>>>
>>> There is partial support of "template overloading" in the standard, and
>>> "overloading" is not inevitable. After all, any case that could be solved
>>> by overloading, could be easily handled with renaming.
>>>
>>
>> We are not defining a new feature exactly, but extending an already
>> existing one (template specialization) such that the template parameter
>> type (TPT) can be unspecified.
>>
>> 2. If we have "template overloading", do we still need "template
>>> specialization"?
>>>
>>> "template specialization" is a widely used technique, and it seems that
>>> "template overloading" has some overlap with "template specialization". If
>>> there is enough motivation to keep both features for type templates, is it
>>> necessary to let function templates support "template specialization"?
>>> Otherwise, do we still need "template specialization"?
>>>
>>
>> Again, this *is* template specialization not template overloading. If
>> we attempted to add template overloading (if I understand your concept of
>> it), it would require a lot of vetting as it would be a large departure
>> from what the language supports now. What I am talking about is a tweak of
>> the current system which is far less risky.
>>
>
> Actually, I think "template overloading" might be more acceptible than the
> feature you propose; at least, it does not break the existing rules in
> declaring a template, and does not require new keywords (or reuse some
> existing keywords) with new semantics.
>
Yes, it still does require compiler support. However, the rules for
template specialization are well understood and an extension would be more
trivial (not trivial, but more so) then attempting to add on a completely
new feature of template overloading. This would be an extension to the
bottom of the template specialization rules as they stand now. This
feature would not break any existing rules and not break any existing code.
--
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/d9b1784f-3453-41f6-8479-a9758e8d48fc%40isocpp.org.
------=_Part_204_318895569.1513605124194
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Monday, December 18, 2017 at 1:10:53 AM UTC-5, =
Mingxin Wang wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;mar=
gin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D=
"ltr"><br>On Monday, December 18, 2017 at 11:06:20 AM UTC+8, <a>adrian....@=
gmail.com</a> wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;mar=
gin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr=
"><blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;bor=
der-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>I am sorry =
that I did not get your idea at the beginning.=C2=A0If my understanding is =
correct this time, your intension is to popularize the term "overloadi=
ng" to type templates.</div></div></blockquote><div><br></div><div>No,=
not overloading.=C2=A0 This is template specialization, with all the same =
rules that that entails.=C2=A0 It would be considered the least specialized=
when matching specializations.=C2=A0 Please see my example above for a mor=
e detailed use case.=C2=A0 However, you can see this work in the following =
minimal example:</div><div><br></div><div><div style=3D"background-color:rg=
b(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-widt=
h:1px;word-wrap:break-word"><code><div><span style=3D"color:#800">// Templa=
te declaration</span><span style=3D"color:#000"><br></span><span style=3D"c=
olor:#008">template</span><span style=3D"color:#000"> </span><span style=3D=
"color:#660"><</span><span style=3D"color:#000">T</span><span style=3D"c=
olor:#660">></span><span style=3D"color:#000"><br></span><span style=3D"=
color:#008">struct</span><span style=3D"color:#000"> X</span><span style=3D=
"color:#660">;</span><span style=3D"color:#000"><br><br><br></span><span st=
yle=3D"color:#800">// Specialization 1</span><span style=3D"color:#000"><br=
></span><span style=3D"color:#008">template</span><span style=3D"color:#000=
"> </span><span style=3D"color:#660"><</span><span style=3D"color:#008">=
auto</span><span style=3D"color:#000"> C</span><span style=3D"color:#660">&=
gt;</span><span style=3D"color:#000"><br></span><span style=3D"color:#008">=
struct</span><span style=3D"color:#000"> X</span><span style=3D"color:#660"=
><</span><span style=3D"color:#000">C</span><span style=3D"color:#660">&=
gt;</span><span style=3D"color:#000"><br></span><span style=3D"color:#660">=
{</span><span style=3D"color:#000"><br>=C2=A0 </span><span style=3D"color:#=
800">// C is a template constant</span><span style=3D"color:#000"><br></spa=
n><span style=3D"color:#660">};</span><span style=3D"color:#000"><br><br><b=
r></span><span style=3D"color:#800">// Specialization 1a</span><span style=
=3D"color:#000"><br></span><span style=3D"color:#008">template</span><span =
style=3D"color:#000"> </span><span style=3D"color:#660"><</span><span st=
yle=3D"color:#008">typename</span><span style=3D"color:#000"> T</span><span=
style=3D"color:#660">,</span><span style=3D"color:#000"> T C</span><span s=
tyle=3D"color:#660">></span><span style=3D"color:#000"><br></span><span =
style=3D"color:#008">struct</span><span style=3D"color:#000"> X</span><span=
style=3D"color:#660"><</span><span style=3D"color:#000">C</span><span s=
tyle=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 </span><=
span style=3D"color:#800">// C is a template constant (same as above)</span=
><span style=3D"color:#000"><br>=C2=A0 </span><span style=3D"color:#800">//=
T is the type of the constant</span><span style=3D"color:#000"><br>=C2=A0 =
</span><span style=3D"color:#800">// This specialization cannot exist in ta=
ndem with the one above</span><span style=3D"color:#000"><br>=C2=A0 </span>=
<span style=3D"color:#800">// (Specialization 1) as they are equivalent and=
would cause an ambiguity</span><span style=3D"color:#000"><br>=C2=A0 </spa=
n><span style=3D"color:#800">// error.</span><span style=3D"color:#000"><br=
></span><span style=3D"color:#660">};</span><span style=3D"color:#000"><br>=
<br><br></span><span style=3D"color:#800">// Specialization 2</span><span s=
tyle=3D"color:#000"><br></span><span style=3D"color:#008">template</span><s=
pan style=3D"color:#000"> </span><span style=3D"color:#660"><</span><spa=
n style=3D"color:#008">typename</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:#008">struct</span><span style=3D"color:#000"> X</span=
><span style=3D"color:#660"><</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><span style=3D"color:#000"><br>=C2=A0 </=
span><span style=3D"color:#800">// T is a typename</span><span style=3D"col=
or:#000"><br></span><span style=3D"color:#660">};</span><span style=3D"colo=
r:#000"><br><br><br></span><span style=3D"color:#800">// Specialization 3</=
span><span style=3D"color:#000"><br></span><span style=3D"color:#008">templ=
ate</span><span style=3D"color:#000"> </span><span style=3D"color:#660"><=
;</span><span style=3D"color:#008">template</span><span style=3D"color:#000=
"> </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"> TT</span><span style=3D"color:#660">></span><span style=3D"color:=
#000"><br></span><span style=3D"color:#008">struct</span><span style=3D"col=
or:#000"> X</span><span style=3D"color:#660"><</span><span style=3D"colo=
r:#000">TT</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 </span><span style=3D"color:#800">// TT is a template that =
takes any number of UTPT.</span><span style=3D"color:#000"><br></span><span=
style=3D"color:#660">};</span><span style=3D"color:#000"><br><br><br></spa=
n><span style=3D"color:#800">// Specialization 3a</span><span style=3D"colo=
r:#000"><br></span><span style=3D"color:#008">template</span><span style=3D=
"color:#000"> </span><span style=3D"color:#660"><</span><span style=3D"c=
olor:#008">template</span><span style=3D"color:#000"> </span><span style=3D=
"color:#660"><</span><span style=3D"color:#008">auto</span><span style=
=3D"color:#660">...></span><span style=3D"color:#000"> </span><span styl=
e=3D"color:#008">class</span><span style=3D"color:#000"> TT</span><span sty=
le=3D"color:#660">></span><span style=3D"color:#000"><br></span><span st=
yle=3D"color:#008">struct</span><span style=3D"color:#000"> X</span><span s=
tyle=3D"color:#660"><</span><span style=3D"color:#000">TT</span><span st=
yle=3D"color:#660">></span><span style=3D"color:#000"><br></span><span s=
tyle=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 </span><s=
pan style=3D"color:#800">// TT is a template that takes any number of const=
ant TPTs.</span><span style=3D"color:#000"><br></span><span style=3D"color:=
#660">};</span><span style=3D"color:#000"><br><br><br></span><span style=3D=
"color:#800">// Specialization 3b</span><span style=3D"color:#000"><br></sp=
an><span style=3D"color:#008">template</span><span style=3D"color:#000"> </=
span><span style=3D"color:#660"><</span><span style=3D"color:#008">templ=
ate</span><span style=3D"color:#000"> </span><span style=3D"color:#660"><=
;</span><span style=3D"color:#008">typename</span><span style=3D"color:#660=
">...></span><span style=3D"color:#000"> </span><span style=3D"color:#00=
8">class</span><span style=3D"color:#000"> TT</span><span style=3D"color:#6=
60">></span><span style=3D"color:#000"><br></span><span style=3D"color:#=
008">struct</span><span style=3D"color:#000"> X</span><span style=3D"color:=
#660"><</span><span style=3D"color:#000">TT</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 </span><span style=3D"c=
olor:#800">// TT is a template that takes any number of typename TPTs.</spa=
n><span style=3D"color:#000"><br></span><span style=3D"color:#660">};</span=
><span style=3D"color:#000"><br><br><br></span><span style=3D"color:#800">/=
/ Specialization 3c</span><span style=3D"color:#000"><br></span><span style=
=3D"color:#008">template</span><span style=3D"color:#000"> </span><span sty=
le=3D"color:#660"><</span><span style=3D"color:#008">template</span><spa=
n style=3D"color:#000"> </span><span style=3D"color:#660"><</span><span =
style=3D"color:#008">template</span><span style=3D"color:#000"> </span><spa=
n 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:#008">class</=
span><span style=3D"color:#000"> TT</span><span style=3D"color:#660">></=
span><span style=3D"color:#000"><br></span><span style=3D"color:#008">struc=
t</span><span style=3D"color:#000"> X</span><span style=3D"color:#660"><=
</span><span style=3D"color:#000">TT</span><span style=3D"color:#660">><=
/span><span style=3D"color:#000"><br></span><span style=3D"color:#660">{</s=
pan><span style=3D"color:#000"><br>=C2=A0 </span><span style=3D"color:#800"=
>// TT is a template that takes any number of template TPTs that take any</=
span><span style=3D"color:#000"><br>=C2=A0 </span><span style=3D"color:#800=
">// number of UTPTs.</span><span style=3D"color:#000"><br></span><span sty=
le=3D"color:#660">};</span><span style=3D"color:#000"><br><br><br></span><s=
pan style=3D"color:#800">// Specialization 3d</span><span style=3D"color:#0=
00"><br></span><span style=3D"color:#008">template</span><span style=3D"col=
or:#000"> </span><span style=3D"color:#660"><</span><span style=3D"color=
:#008">template</span><span style=3D"color:#000"> </span><span style=3D"col=
or:#660"><</span><span style=3D"color:#008">template</span><span style=
=3D"color:#000"> </span><span style=3D"color:#660"><...></span><span =
style=3D"color:#000"> </span><span style=3D"color:#008">class</span><span s=
tyle=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=
=3D"color:#008">typename</span><span style=3D"color:#660">,</span><span sty=
le=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"color:#008">class</span><span style=3D"color:#000"> TT</span><span styl=
e=3D"color:#660">></span><span style=3D"color:#000"><br></span><span sty=
le=3D"color:#008">struct</span><span style=3D"color:#000"> X</span><span st=
yle=3D"color:#660"><</span><span style=3D"color:#000">TT</span><span sty=
le=3D"color:#660">></span><span style=3D"color:#000"><br></span><span st=
yle=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 </span><sp=
an style=3D"color:#800">// TT is a template that takes a template that take=
s any number of UTPTs and</span><span style=3D"color:#000"><br>=C2=A0 </spa=
n><span style=3D"color:#800">// a typename and an int constant.</span><span=
style=3D"color:#000"><br></span><span style=3D"color:#660">};</span><span =
style=3D"color:#000"><br><br></span></div></code></div><div><br>The list ca=
n go on and on.</div></div></div></blockquote><div><br></div><div>It seems =
that you are proposing a core language feature that allows one to pass ANYT=
HING (types, type templates, constexpr values, etc.) on template instantiat=
ion.</div></div></blockquote><div><br></div><div>Yes</div><div>=C2=A0</div>=
<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;bor=
der-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div>I think =
the motivation of this idea is not strong enough to a certain extent, becau=
se:</div><div><br></div><div>1. Types, type templates and constexpr values =
usually have=C2=A0<i>completely</i> different semantics. Thus using this fe=
ature will=C2=A0inevitably=C2=A0carry ambiguation to the semantics of the t=
emplates. For example, if one is supposed to define some types like `X<i=
nt>` (type), `X<123>` (constexpr value) and `X<std::vector>`=
(type template), I do not agree that the three types shall have the same s=
emantics, thus they shall have different names for their respective semanti=
cs, rather than sharing a same one.</div></div></blockquote><div><br></div>=
<div>How does it carry ambiguation to the semantics of templates?=C2=A0 Bei=
ng able to transform any template list to another or into an object would b=
enefit from this.=C2=A0 If you had ever had to wrap a constant in an <font =
face=3D"courier new, monospace">integral_constant</font> just so that it is=
a type that you can iterate over, then you should be able to see that that=
case can be helped with using this proposal.</div><div>=C2=A0</div><blockq=
uote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-lef=
t: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div>2. Any case tha=
t could be solved by this feature, could <i>also</i> be easily handled with=
renaming.</div></div></blockquote><div>=C2=A0</div><div>Have you looked at=
the=C2=A0<font face=3D"courier new, monospace">tbind</font>=C2=A0example a=
bove?=C2=A0 This shows that this feature <i>cannot </i>be handled with rena=
ming, easily or otherwise..</div><div>=C2=A0</div><blockquote class=3D"gmai=
l_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;=
padding-left: 1ex;"><div dir=3D"ltr"><div></div><div>3. Although you are &q=
uot;extending an already existing feature", it is still a core languag=
e feature that requires support from the compiler.=C2=A0</div></div></block=
quote><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8=
ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><b=
r></div><blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8=
ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><blockquot=
e class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px=
#ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>However, some details m=
ight need to be taken into account before standardization.<br></div><div><b=
r></div><div>1. Is the motivation strong enough to define a new language fe=
ature?</div><div><br></div><div>There is partial support of "template =
overloading" in the standard, and "overloading" is not inevi=
table. After all, any case that could be solved by overloading, could be ea=
sily handled with renaming.</div></div></blockquote><div><br></div><div>We =
are not defining a new feature=C2=A0 exactly, but extending an already exis=
ting one (template specialization) such that the template parameter type (T=
PT) can be unspecified.=C2=A0</div><div><br></div><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"><div>2. If we have "template overloadi=
ng", do we still need "template specialization"?</div><div><=
br></div><div>"template specialization" is a widely used=C2=A0tec=
hnique, and it seems that "template overloading" has some overlap=
with "template specialization". If there is enough motivation to=
keep both features for type templates, is it necessary to let function tem=
plates support "template specialization"? Otherwise, do we still =
need "template specialization"?<br></div></div></blockquote><div>=
<br></div><div>Again, this <i>is</i> template specialization not template o=
verloading.=C2=A0 If we attempted to add template overloading (if I underst=
and your concept of it), it would require a lot of vetting as it would be a=
large departure from what the language supports now.=C2=A0 What I am talki=
ng about is a tweak of the current system which is far less risky.</div></d=
iv></blockquote><div><br></div><div>Actually, I think "template overlo=
ading" might be more acceptible than the feature you propose; at least=
, it does not break the existing rules in declaring a template, and does no=
t require new keywords (or reuse some existing keywords) with new semantics=
..</div></div></blockquote><div><br></div><div>Yes, it still does require co=
mpiler support. However, the rules for template specialization are well und=
erstood and an extension would be more trivial (not trivial, but more so) t=
hen attempting to add on a completely new feature of template overloading.=
=C2=A0 This would be an extension to the bottom of the template specializat=
ion rules as they stand now.=C2=A0 This feature would not break any existin=
g rules and not break any existing code.<br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/d9b1784f-3453-41f6-8479-a9758e8d48fc%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/d9b1784f-3453-41f6-8479-a9758e8d48fc=
%40isocpp.org</a>.<br />
------=_Part_204_318895569.1513605124194--
------=_Part_203_278525128.1513605124193--
.
Author: bastienpenava@gmail.com
Date: Tue, 19 Dec 2017 10:33:37 -0800 (PST)
Raw View
------=_Part_1205_607689961.1513708417839
Content-Type: multipart/alternative;
boundary="----=_Part_1206_1742782079.1513708417840"
------=_Part_1206_1742782079.1513708417840
Content-Type: text/plain; charset="UTF-8"
Enter code here...
On Thursday, December 14, 2017 at 6:30:43 PM UTC+1, Nicol Bolas wrote:
>
> On Thursday, December 14, 2017 at 11:53:55 AM UTC-5, bastie...@gmail.com
> wrote:
>>
>> On Thursday, December 14, 2017 at 5:06:57 PM UTC+1, Nicol Bolas wrote:
>>>
>>> On Thursday, December 14, 2017 at 9:25:24 AM UTC-5, bastie...@gmail.com
>>> wrote:
>>>>
>>>> On Thursday, December 14, 2017 at 11:24:41 AM UTC+1, Mingxin Wang wrote:
>>>>>
>>>>> On Thursday, December 14, 2017 at 4:31:03 PM UTC+8,
>>>>> bastie...@gmail.com wrote
>>>>>
>>>> 2. I could not find a case that your idea could give full play to the
>>>>> advantages.
>>>>>
>>>> I can give you one that's would be simple to use and useful :
>>>> named_tuple.
>>>>
>>>> named_tuple<int, "age", string, "name"> x;
>>>> x.get<"name">() = get_user_name();
>>>> static_assert(std::is_same_v<std::string &, decltype(std::get<1>())>);
>>>>
>>>>
>>> Which can be accomplished adequately enough in other ways (assuming we
>>> allow strings in template parameters):
>>>
>> strings as template parameters was adopted by the evolution working group
>> during the meeting of November :
>> https://botondballo.wordpress.com/2017/11/20/trip-report-c-standards-meeting-in-albuquerque-november-2017/
>> <https://botondballo.wordpress.com/2017/11/20/trip-report-c-standards-meeting-in-albuquerque-november-2017/>
>>
>>>
>>> named_tuple<tag<"age", int>, tag<"name", string>>;
>>>
>>>
>> Indeed, I think this would be a much better solution. First, it allows
>>> you to have named_tuples with unnamed elements (`named_tuple<int,
>>> tag<"name", string>>`). Second, I think it makes it easier on the
>>> implementation side. For example, if you want to write a metafunction that
>>> takes a `named_tuple<...>` and generates a list of its types, you can do
>>> this:
>>>
>>> template<typename T>
>>> struct get_type_from_tag
>>> {
>>> using type = T;
>>> };
>>>
>>> template<const char *Str, typename T>
>>> struct get_type_from_tag<tag<Str, T>
>>> {
>>> using type = T;
>>> };
>>>
>>> template<T>
>>> using get_type_from_tag_t = typename get_type_from_tag<T>::type;
>>>
>>> template<typename Tpl>
>>> struct types_from_tuple {};
>>>
>>> template<typename ...Ts>
>>> struct types_from_tuple<named_tuple<Ts...>>
>>> {
>>> using type = type_list<get_type_from_tag_t<Ts>...>;
>>> };
>>>
>>> The metafunction for your code's equivalent would not be able to use
>>> expansion like that. Since every pair of `T` in the argument list contains
>>> the actual type, you would need to use recursion to extract the list of
>>> `T`s. Not the hardest thing in the world, but hardly as straightforward as
>>> this.
>>>
>>
>> I agree that it can be expressed through type tagging. That being said do
>> you think that such a solution could ever be part of std?
>>
>
> ... why not?
>
> Whether you use a tag type or your suggestion, it would be a very breaking
> change to allow `std::tuple` itself to gain this feature. After all, people
> already have a lot of code that expects `tuple` to take only typenames, and
> that those typenames directly map to the types the `tuple` stores.
>
> So however it happens, it must be a new type. And there's no reason why
> the `tag`ed version couldn't be standardized.
>
> This is an odd pattern that requires implementation knowledge on the part
>> of the user.
>>
>
> No more odd than the idea that you pass a sequence of string and type
> pairs. Certainly, no other type accepts such a thing at present.
>
> By contrast, while the standard library doesn't use tagged template
> parameters, there are several C++ libraries that do. So at least some
> programmers are familiar with the concept.
>
> On the implementation side I've worked on a non-recursive implementation
>> that would rely on lambdas in unevaluated context (also opted in C++20) and
>> that I believe could also allow optional names.
>> That being said it is more difficult to write but library features are
>> usually more difficult to write the more they wish to be easy to use.
>>
>
> I thought the whole point of this feature was to make template programming*
> easier*, not harder.
>
Actually I said it was useful and easier to use, not that it somehow made
variadic templates easy to handle.
The point of this idea is to increase expressivity for the library writer
and simplify its utilisation by the user.
As for the unevaluated lambdas, it is not required at all but they have the
benefit to be inaccessible for the user (as opposed to tool classes/fn
hidden in namespaces).
My issue with tagged types is that it's a fix not a solution.
It's a pattern where the user has to know a type and a tool type just to
use it (two names required to express one idea).
I'm aware that it is used by a bunch of libraries and the reason why they
do so is because there are no alternatives (or they are even worse for the
user: decltype over overload function call, etc..).
Going back the the generic template parameter idea, generally speaking this
idea has the same goals, consequences, etc..., as the "auto non-type
parameter" proposal had.
On the named_tuple example, I believe that allowing a variable amount of
strings after the type would make the tag implementation more difficult
without really affecting the "template" one.
using note = named_tuple<int, "year", "month", "day", double, "grade", std::
string, "subject">;
using note = named_tuple<tag<int,"year","month","day">, tag<double, "grade"
>, tag<std::string,"subject">>;
--
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/38a19f1b-efbc-4522-acfd-79c7bd9df4e6%40isocpp.org.
------=_Part_1206_1742782079.1513708417840
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D"prettyprint" style=3D"background-color: rgb(=
250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; bord=
er-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div cla=
ss=3D"subprettyprint"><span style=3D"color: #606;" class=3D"styled-by-prett=
ify">Enter</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
code here</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
....</span></div></code></div><br><br><br>On Thursday, December 14, 2017 at =
6:30:43 PM UTC+1, Nicol Bolas wrote:<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 Thursday, December 14, 2017 at 11:53:55 AM UTC-5,=
<a>bastie...@gmail.com</a> wrote:<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 Thursday, December 14, 2017 at 5:06:57 PM UTC+1, Nicol=
Bolas wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-lef=
t:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">On Th=
ursday, December 14, 2017 at 9:25:24 AM UTC-5, <a>bastie...@gmail.com</a> w=
rote:<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 Thursday, =
December 14, 2017 at 11:24:41 AM UTC+1, Mingxin Wang wrote:<blockquote clas=
s=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc =
solid;padding-left:1ex"><div dir=3D"ltr">On Thursday, December 14, 2017 at =
4:31:03 PM UTC+8, <a>bastie...@gmail.com</a> wrote</div></blockquote></div>=
</blockquote><blockquote class=3D"gmail_quote" style=3D"margin:0;margin-lef=
t:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-lef=
t:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">2. I could not find a c=
ase that your idea could give full play to the advantages.</div></blockquot=
e></div></blockquote><blockquote class=3D"gmail_quote" style=3D"margin:0;ma=
rgin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"lt=
r"><div>=C2=A0I can give you one that's would be simple to use and usef=
ul : named_tuple.</div><div><br></div><div style=3D"background-color:rgb(25=
0,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1p=
x;word-wrap:break-word"><code><div><span style=3D"color:#000">named_tuple</=
span><span style=3D"color:#660"><</span><span style=3D"color:#008">int</=
span><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span>=
<span style=3D"color:#080">"age"</span><span style=3D"color:#660"=
>,</span><span style=3D"color:#000"> </span><span style=3D"color:#008">stri=
ng</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#080">"name"</span><span style=3D"color:=
#660">></span><span style=3D"color:#000"> x</span><span style=3D"color:#=
660">;</span><span style=3D"color:#000"><br>x</span><span style=3D"color:#6=
60">.</span><span style=3D"color:#008">get</span><span style=3D"color:#660"=
><</span><span style=3D"color:#080">"name"</span><span style=
=3D"color:#660">>()</span><span style=3D"color:#000"> </span><span style=
=3D"color:#660">=3D</span><span style=3D"color:#000"> get_user_name</span><=
span style=3D"color:#660">();</span><span style=3D"color:#000"><br></span><=
span style=3D"color:#008">static_assert</span><span style=3D"color:#660">(<=
/span><span style=3D"color:#000">std</span><span style=3D"color:#660">::</s=
pan><span style=3D"color:#000">is_same_v</span><span style=3D"color:#660">&=
lt;</span><span style=3D"color:#000">s<wbr>td</span><span style=3D"color:#6=
60">::</span><span style=3D"color:#008">string</span><span style=3D"color:#=
000"> </span><span style=3D"color:#660">&,</span><span style=3D"color:#=
000"> </span><span style=3D"color:#008">decltype</span><span style=3D"color=
:#660">(</span><span style=3D"color:#000">std</span><span style=3D"color:#6=
60">::</span><span style=3D"color:#008">get</span><span style=3D"color:#660=
"><</span><span style=3D"color:#066">1</span><span style=3D"color:#660">=
>())>);</span></div></code></div><div><br></div></div></blockquote><d=
iv><br></div><div><div>Which can be accomplished adequately enough in other=
ways (assuming we allow strings in template parameters):=C2=A0</div></div>=
</div></blockquote><div>strings as template parameters was adopted by the e=
volution working group during the meeting of November :=C2=A0<a href=3D"htt=
ps://botondballo.wordpress.com/2017/11/20/trip-report-c-standards-meeting-i=
n-albuquerque-november-2017/" rel=3D"nofollow" target=3D"_blank" onmousedow=
n=3D"this.href=3D'https://www.google.com/url?q\x3dhttps%3A%2F%2Fbotondb=
allo.wordpress.com%2F2017%2F11%2F20%2Ftrip-report-c-standards-meeting-in-al=
buquerque-november-2017%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF_vL5Ngr=
4VIpnzXg9U_LHKICBxaA';return true;" onclick=3D"this.href=3D'https:/=
/www.google.com/url?q\x3dhttps%3A%2F%2Fbotondballo.wordpress.com%2F2017%2F1=
1%2F20%2Ftrip-report-c-standards-meeting-in-albuquerque-november-2017%2F\x2=
6sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF_vL5Ngr4VIpnzXg9U_LHKICBxaA';ret=
urn true;">https://botondballo.<wbr>wordpress.com/2017/11/20/trip-<wbr>repo=
rt-c-standards-meeting-in-<wbr>albuquerque-november-2017/=C2=A0</a></div><b=
lockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-=
left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><div><br></div>=
<div style=3D"border:1px solid rgb(187,187,187);word-wrap:break-word;backgr=
ound-color:rgb(250,250,250)"><code><div><span style=3D"color:#000">named_tu=
ple</span><span style=3D"color:#660"><</span><span style=3D"color:#000">=
tag</span><span style=3D"color:#660"><</span><span style=3D"color:#080">=
"age"</span><span style=3D"color:#660">,</span><span style=3D"col=
or:#000"> </span><span style=3D"color:#008">int</span><span style=3D"color:=
#660">>,</span><span style=3D"color:#000"> tag</span><span style=3D"colo=
r:#660"><</span><span style=3D"color:#080">"name"</span><span =
style=3D"color:#660">,</span><span style=3D"color:#000"> </span><span style=
=3D"color:#008">string</span><span style=3D"color:#660">>>;</span></d=
iv></code></div><div>=C2=A0<br></div></div></div></blockquote><blockquote c=
lass=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #c=
cc solid;padding-left:1ex"><div dir=3D"ltr"><div><div></div><div>Indeed,
I think this would be a much better solution. First, it allows you to have=
named_tuples with unnamed elements (`named_tuple<int, tag<"name=
", string>>`). Second, I think it makes it easier on the impleme=
ntation=20
side. For example, if you=20
want to write a metafunction that takes a `named_tuple<...>`=20
and generates a list of its types, you can do this:</div><div><br></div><di=
v style=3D"border:1px solid rgb(187,187,187);word-wrap:break-word;backgroun=
d-color:rgb(250,250,250)"><code><div><span style=3D"color:#008">template</s=
pan><span style=3D"color:#660"><</span><span style=3D"color:#008">typena=
me</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:#008">st=
ruct</span><span style=3D"color:#000"> get_type_from_tag<br></span><span st=
yle=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 </span><sp=
an style=3D"color:#008">using</span><span style=3D"color:#000"> type </span=
><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> T</span><=
span style=3D"color:#660">;</span><span style=3D"color:#000"><br></span><sp=
an 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"><</=
span><span style=3D"color:#008">const</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#008">char</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#660">*</span><span style=3D"color:#606">Str</span><=
span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><span =
style=3D"color:#008">typename</span><span style=3D"color:#000"> T</span><sp=
an style=3D"color:#660">></span><span style=3D"color:#000"><br></span><s=
pan style=3D"color:#008">struct</span><span style=3D"color:#000"> get_type_=
from_tag</span><span style=3D"color:#660"><</span><span style=3D"color:#=
000">tag</span><span style=3D"color:#660"><</span><span style=3D"color:#=
606">Str</span><span style=3D"color:#660">,</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><span style=3D"color:#000"><=
br>=C2=A0 </span><span style=3D"color:#008">using</span><span style=3D"colo=
r:#000"> type </span><span style=3D"color:#660">=3D</span><span style=3D"co=
lor:#000"> 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><br></span><span style=3D"color:#008">template</span><span style=
=3D"color:#660"><</span><span style=3D"color:#000">T</span><span style=
=3D"color:#660">></span><span style=3D"color:#000"><br></span><span styl=
e=3D"color:#008">using</span><span style=3D"color:#000"> get_type_from_tag_=
t </span><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> <=
/span><span style=3D"color:#008">typename</span><span style=3D"color:#000">=
get_type_from_tag</span><span style=3D"color:#660"><</span><span style=
=3D"color:#000">T</span><span style=3D"color:#660">>::</span><span style=
=3D"color:#000">type</span><span style=3D"color:#660">;</span><span style=
=3D"color:#000"><br><br></span><span style=3D"color:#008">template</span><s=
pan style=3D"color:#660"><</span><span style=3D"color:#008">typename</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#606">Tpl</span>=
<span style=3D"color:#660">></span><span style=3D"color:#000"><br></span=
><span style=3D"color:#008">struct</span><span style=3D"color:#000"> types_=
from_tuple </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"><</span><span style=3D"color:#008">typename</span><span =
style=3D"color:#000"> </span><span style=3D"color:#660">...</span><span sty=
le=3D"color:#606">Ts</span><span style=3D"color:#660">></span><span styl=
e=3D"color:#000"><br></span><span style=3D"color:#008">struct</span><span s=
tyle=3D"color:#000"> types_from_tuple</span><span style=3D"color:#660"><=
</span><span style=3D"color:#000">named_tuple</span><span style=3D"color:#6=
60"><</span><span style=3D"color:#606">T<wbr>s</span><span style=3D"colo=
r:#660">...>></span><span style=3D"color:#000"><br></span><span style=
=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 </span><span =
style=3D"color:#008">using</span><span style=3D"color:#000"> type </span><s=
pan style=3D"color:#660">=3D</span><span style=3D"color:#000"> type_list</s=
pan><span style=3D"color:#660"><</span><span style=3D"color:#000">get_ty=
pe_from_tag_t</span><span style=3D"color:#660"><</span><span style=3D"co=
lor:#606"><wbr>Ts</span><span style=3D"color:#660">>...>;</span><span=
style=3D"color:#000"><br></span><span style=3D"color:#660">};</span></div>=
</code></div><div><br></div><div>The metafunction for your code's equiv=
alent would not be able to use expansion like that. Since every pair of `T`=
in the argument list contains the actual type, you would need to use recur=
sion to extract the list of `T`s. Not the hardest thing in the world, but h=
ardly as straightforward as this.</div></div></div></blockquote><div><br></=
div><div>I agree that it can be expressed through type tagging. That being =
said do you think that such a solution could ever be part of std?</div></di=
v></blockquote><div><br></div><div>... why not?</div><div><br></div><div>Wh=
ether you use a tag type or your suggestion, it would be a very breaking ch=
ange to allow `std::tuple` itself to gain this feature. After all, people a=
lready have a lot of code that expects `tuple` to take only typenames, and =
that those typenames directly map to the types the `tuple` stores.</div><di=
v><br></div><div>So however it happens, it must be a new type. And there=
9;s no reason why the `tag`ed version couldn't be standardized.</div><d=
iv><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0;margin-lef=
t:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>=
This is an odd pattern that requires implementation knowledge on the part o=
f the user.</div></div></blockquote><div><br></div><div>No more odd than th=
e idea that you pass a sequence of string and type pairs. Certainly, no oth=
er type accepts such a thing at present.</div><div><br></div><div>By contra=
st, while the standard library doesn't use tagged template parameters, =
there are several C++ libraries that do. So at least some programmers are f=
amiliar with the concept.</div><div><br></div><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding=
-left:1ex"><div dir=3D"ltr"><div>On the implementation side I've worked=
on a non-recursive implementation that would rely on lambdas in unevaluate=
d context (also opted in C++20) and that I believe could also allow optiona=
l names.</div><div>That being said it is more difficult to write but librar=
y features are usually more difficult to write the more they wish to be eas=
y to use.</div></div></blockquote><div><br></div><div>I thought the whole p=
oint of this feature was to make template programming<i> easier</i>, not ha=
rder.</div></div></blockquote><div><br></div><div>Actually I said it was us=
eful and easier to use, not that it somehow made variadic templates easy to=
handle.</div><div>The point of this idea is to increase expressivity for t=
he library writer and simplify its utilisation by the user.<br></div><div>A=
s for the unevaluated lambdas, it is not required at all but they have the =
benefit to be inaccessible for the user (as opposed to tool classes/fn hidd=
en in namespaces).</div><div><br></div><div>My issue with tagged types is t=
hat it's a fix not a solution.</div><div>It's a pattern where the u=
ser has to know a type and a tool type just to use it (two names required t=
o express one idea).</div><div>I'm aware that it is used by a bunch of =
libraries and the reason why they do so is because there are no alternative=
s (or they are even worse for the user: decltype over overload function cal=
l, etc..).<br></div><div><br></div><div>Going back the the generic template=
parameter idea, generally speaking this idea has the same goals, consequen=
ces, etc..., as the "auto non-type parameter" proposal had.</div>=
<div><br></div><div>On the named_tuple example, I believe that allowing a v=
ariable amount of strings after the type would make the tag implementation =
more difficult without really affecting the "template" one.</div>=
<div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); b=
order-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; wo=
rd-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subprettypr=
int"><span style=3D"color: #008;" class=3D"styled-by-prettify">using</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> note </span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> named_tuple</span><span sty=
le=3D"color: #660;" 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;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #080;" class=3D"st=
yled-by-prettify">"year"</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">"month"</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: #080;" class=3D"styled-by-prettify">"=
;day"</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">double</span><span=
style=3D"color: #660;" 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">"grade"</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> std</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">::</span><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">string</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;subject"</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">>;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">using=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> note </sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> named_tuple</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">tag</span><span style=3D"=
color: #660;" 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: #080;" class=3D=
"styled-by-prettify">"year"</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">,</span><span style=3D"color: #080;" class=3D"st=
yled-by-prettify">"month"</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">,</span><span style=3D"color: #080;" class=3D"styl=
ed-by-prettify">"day"</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">>,</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> tag</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify"><</span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">double</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #080;" class=3D"styled-by-prettify">"grade"<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">>,</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> tag</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"col=
or: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">string</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">,</span><span style=3D"color: #080;" class=3D"s=
tyled-by-prettify">"subject"</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">>>;</span></div></code></div><br></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/38a19f1b-efbc-4522-acfd-79c7bd9df4e6%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/38a19f1b-efbc-4522-acfd-79c7bd9df4e6=
%40isocpp.org</a>.<br />
------=_Part_1206_1742782079.1513708417840--
------=_Part_1205_607689961.1513708417839--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Tue, 19 Dec 2017 12:16:16 -0800 (PST)
Raw View
------=_Part_31121_806240747.1513714576529
Content-Type: multipart/alternative;
boundary="----=_Part_31122_249712809.1513714576529"
------=_Part_31122_249712809.1513714576529
Content-Type: text/plain; charset="UTF-8"
On Tuesday, December 19, 2017 at 1:33:38 PM UTC-5, bastie...@gmail.com
wrote:
>
> Enter code here...
>
>
>
> On Thursday, December 14, 2017 at 6:30:43 PM UTC+1, Nicol Bolas wrote:
>>
>> On Thursday, December 14, 2017 at 11:53:55 AM UTC-5, bastie...@gmail.com
>> wrote:
>>>
>>> On Thursday, December 14, 2017 at 5:06:57 PM UTC+1, Nicol Bolas wrote:
>>>>
>>>> On Thursday, December 14, 2017 at 9:25:24 AM UTC-5, bastie...@gmail.com
>>>> wrote:
>>>>>
>>>>> On Thursday, December 14, 2017 at 11:24:41 AM UTC+1, Mingxin Wang
>>>>> wrote:
>>>>>>
>>>>>> On Thursday, December 14, 2017 at 4:31:03 PM UTC+8,
>>>>>> bastie...@gmail.com wrote
>>>>>>
>>>>> 2. I could not find a case that your idea could give full play to the
>>>>>> advantages.
>>>>>>
>>>>> I can give you one that's would be simple to use and useful :
>>>>> named_tuple.
>>>>>
>>>>> named_tuple<int, "age", string, "name"> x;
>>>>> x.get<"name">() = get_user_name();
>>>>> static_assert(std::is_same_v<std::string &, decltype(std::get<1>())>);
>>>>>
>>>>>
>>>> Which can be accomplished adequately enough in other ways (assuming we
>>>> allow strings in template parameters):
>>>>
>>> strings as template parameters was adopted by the evolution working
>>> group during the meeting of November :
>>> https://botondballo.wordpress.com/2017/11/20/trip-report-c-standards-meeting-in-albuquerque-november-2017/
>>> <https://botondballo.wordpress.com/2017/11/20/trip-report-c-standards-meeting-in-albuquerque-november-2017/>
>>>
>>>>
>>>> named_tuple<tag<"age", int>, tag<"name", string>>;
>>>>
>>>>
>>> Indeed, I think this would be a much better solution. First, it allows
>>>> you to have named_tuples with unnamed elements (`named_tuple<int,
>>>> tag<"name", string>>`). Second, I think it makes it easier on the
>>>> implementation side. For example, if you want to write a metafunction that
>>>> takes a `named_tuple<...>` and generates a list of its types, you can do
>>>> this:
>>>>
>>>> template<typename T>
>>>> struct get_type_from_tag
>>>> {
>>>> using type = T;
>>>> };
>>>>
>>>> template<const char *Str, typename T>
>>>> struct get_type_from_tag<tag<Str, T>
>>>> {
>>>> using type = T;
>>>> };
>>>>
>>>> template<T>
>>>> using get_type_from_tag_t = typename get_type_from_tag<T>::type;
>>>>
>>>> template<typename Tpl>
>>>> struct types_from_tuple {};
>>>>
>>>> template<typename ...Ts>
>>>> struct types_from_tuple<named_tuple<Ts...>>
>>>> {
>>>> using type = type_list<get_type_from_tag_t<Ts>...>;
>>>> };
>>>>
>>>> The metafunction for your code's equivalent would not be able to use
>>>> expansion like that. Since every pair of `T` in the argument list contains
>>>> the actual type, you would need to use recursion to extract the list of
>>>> `T`s. Not the hardest thing in the world, but hardly as straightforward as
>>>> this.
>>>>
>>>
>>> I agree that it can be expressed through type tagging. That being said
>>> do you think that such a solution could ever be part of std?
>>>
>>
>> ... why not?
>>
>> Whether you use a tag type or your suggestion, it would be a very
>> breaking change to allow `std::tuple` itself to gain this feature. After
>> all, people already have a lot of code that expects `tuple` to take only
>> typenames, and that those typenames directly map to the types the `tuple`
>> stores.
>>
>> So however it happens, it must be a new type. And there's no reason why
>> the `tag`ed version couldn't be standardized.
>>
>> This is an odd pattern that requires implementation knowledge on the part
>>> of the user.
>>>
>>
>> No more odd than the idea that you pass a sequence of string and type
>> pairs. Certainly, no other type accepts such a thing at present.
>>
>> By contrast, while the standard library doesn't use tagged template
>> parameters, there are several C++ libraries that do. So at least some
>> programmers are familiar with the concept.
>>
>> On the implementation side I've worked on a non-recursive implementation
>>> that would rely on lambdas in unevaluated context (also opted in C++20) and
>>> that I believe could also allow optional names.
>>> That being said it is more difficult to write but library features are
>>> usually more difficult to write the more they wish to be easy to use.
>>>
>>
>> I thought the whole point of this feature was to make template programming*
>> easier*, not harder.
>>
>
> Actually I said it was useful and easier to use, not that it somehow made
> variadic templates easy to handle.
>
Does C++ really need more ways to be hard to use?
The point of this idea is to increase expressivity for the library writer
> and simplify its utilisation by the user.
> As for the unevaluated lambdas, it is not required at all but they have
> the benefit to be inaccessible for the user (as opposed to tool classes/fn
> hidden in namespaces).
>
> My issue with tagged types is that it's a fix not a solution.
> It's a pattern where the user has to know a type and a tool type just to
> use it (two names required to express one idea).
>
But it leads to better, more reasonable, and more easily understood code,
for both the user and the library writer. If you see `tagged_tuple<tag<int,
"name">>`, a user can make some guesses about what's going on. But if you
see `named_tuple<int, "name">`, you're not sure what's going on. There is
no obvious relationship between the type and the string.
Furthermore, I'm pretty sure the compile error given by
`tagged_tuple<tag<"name", int>>` will be a lot easier to understand than
the one by `named_tuple<"name", int>`.
I'm aware that it is used by a bunch of libraries and the reason why they
> do so is because there are no alternatives (or they are even worse for the
> user: decltype over overload function call, etc..).
>
> Going back the the generic template parameter idea, generally speaking
> this idea has the same goals, consequences, etc..., as the "auto non-type
> parameter" proposal had.
>
> On the named_tuple example, I believe that allowing a variable amount of
> strings after the type would make the tag implementation more difficult
> without really affecting the "template" one.
>
But that's only because the generic one is already such a nightmarish beast
to implement that it can't really get worse.
--
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/53e45e81-206a-4406-aa82-0e2bf798af96%40isocpp.org.
------=_Part_31122_249712809.1513714576529
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Tuesday, December 19, 2017 at 1:33:38 PM UTC-5, bastie.=
...@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;mar=
gin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><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;word-wrap:break-word"><code><d=
iv><span style=3D"color:#606">Enter</span><span style=3D"color:#000"> code =
here</span><span style=3D"color:#660">...</span></div></code></div><br><br>=
<br>On Thursday, December 14, 2017 at 6:30:43 PM UTC+1, Nicol Bolas wrote:<=
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 Thursday, Decemb=
er 14, 2017 at 11:53:55 AM UTC-5, <a>bastie...@gmail.com</a> wrote:<blockqu=
ote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1=
px #ccc solid;padding-left:1ex"><div dir=3D"ltr">On Thursday, December 14, =
2017 at 5:06:57 PM UTC+1, Nicol Bolas wrote:<blockquote class=3D"gmail_quot=
e" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-l=
eft:1ex"><div dir=3D"ltr">On Thursday, December 14, 2017 at 9:25:24 AM UTC-=
5, <a>bastie...@gmail.com</a> wrote:<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 Thursday, December 14, 2017 at 11:24:41 AM UTC+1, Ming=
xin Wang wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-l=
eft:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">On =
Thursday, December 14, 2017 at 4:31:03 PM UTC+8, <a>bastie...@gmail.com</a>=
wrote</div></blockquote></div></blockquote><blockquote class=3D"gmail_quot=
e" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-l=
eft:1ex"><div dir=3D"ltr"><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">2. I could not find a case that your idea could give full play to =
the advantages.</div></blockquote></div></blockquote><blockquote class=3D"g=
mail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;=
padding-left:1ex"><div dir=3D"ltr"><div>=C2=A0I can give you one that's=
would be simple to use and useful : named_tuple.</div><div><br></div><div =
style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);bo=
rder-style:solid;border-width:1px;word-wrap:break-word"><code><div><span st=
yle=3D"color:#000">named_tuple</span><span style=3D"color:#660"><</span>=
<span style=3D"color:#008">int</span><span style=3D"color:#660">,</span><sp=
an style=3D"color:#000"> </span><span style=3D"color:#080">"age"<=
/span><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span=
><span style=3D"color:#008">string</span><span style=3D"color:#660">,</span=
><span style=3D"color:#000"> </span><span style=3D"color:#080">"name&q=
uot;</span><span style=3D"color:#660">></span><span style=3D"color:#000"=
> x</span><span style=3D"color:#660">;</span><span style=3D"color:#000"><br=
>x</span><span style=3D"color:#660">.</span><span style=3D"color:#008">get<=
/span><span style=3D"color:#660"><</span><span style=3D"color:#080">&quo=
t;name"</span><span style=3D"color:#660">>()</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#660">=3D</span><span style=3D"colo=
r:#000"> get_user_name</span><span style=3D"color:#660">();</span><span sty=
le=3D"color:#000"><br></span><span style=3D"color:#008">static_assert</span=
><span style=3D"color:#660">(</span><span style=3D"color:#000">std</span><s=
pan style=3D"color:#660">::</span><span style=3D"color:#000">is_same_v</spa=
n><span style=3D"color:#660"><</span><span style=3D"color:#000">s<wbr>td=
</span><span style=3D"color:#660">::</span><span style=3D"color:#008">strin=
g</span><span style=3D"color:#000"> </span><span style=3D"color:#660">&=
,</span><span style=3D"color:#000"> </span><span style=3D"color:#008">declt=
ype</span><span style=3D"color:#660">(</span><span style=3D"color:#000">std=
</span><span style=3D"color:#660">::</span><span style=3D"color:#008">get</=
span><span style=3D"color:#660"><</span><span style=3D"color:#066">1</sp=
an><span style=3D"color:#660">>())>);</span></div></code></div><div><=
br></div></div></blockquote><div><br></div><div><div>Which can be accomplis=
hed adequately enough in other ways (assuming we allow strings in template =
parameters):=C2=A0</div></div></div></blockquote><div>strings as template p=
arameters was adopted by the evolution working group during the meeting of =
November :=C2=A0<a onmousedown=3D"this.href=3D'https://www.google.com/u=
rl?q\x3dhttps%3A%2F%2Fbotondballo.wordpress.com%2F2017%2F11%2F20%2Ftrip-rep=
ort-c-standards-meeting-in-albuquerque-november-2017%2F\x26sa\x3dD\x26sntz\=
x3d1\x26usg\x3dAFQjCNF_vL5Ngr4VIpnzXg9U_LHKICBxaA';return true;" onclic=
k=3D"this.href=3D'https://www.google.com/url?q\x3dhttps%3A%2F%2Fbotondb=
allo.wordpress.com%2F2017%2F11%2F20%2Ftrip-report-c-standards-meeting-in-al=
buquerque-november-2017%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF_vL5Ngr=
4VIpnzXg9U_LHKICBxaA';return true;" href=3D"https://botondballo.wordpre=
ss.com/2017/11/20/trip-report-c-standards-meeting-in-albuquerque-november-2=
017/" target=3D"_blank" rel=3D"nofollow">https://botondballo.<wbr>wordpress=
..com/2017/11/20/trip-<wbr>report-c-standards-meeting-in-<wbr>albuquerque-no=
vember-2017/=C2=A0</a></div><blockquote class=3D"gmail_quote" style=3D"marg=
in:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div di=
r=3D"ltr"><div><div><br></div><div style=3D"border:1px solid rgb(187,187,18=
7);word-wrap:break-word;background-color:rgb(250,250,250)"><code><div><span=
style=3D"color:#000">named_tuple</span><span style=3D"color:#660"><</sp=
an><span style=3D"color:#000">tag</span><span style=3D"color:#660"><</sp=
an><span style=3D"color:#080">"age"</span><span style=3D"color:#6=
60">,</span><span style=3D"color:#000"> </span><span style=3D"color:#008">i=
nt</span><span style=3D"color:#660">>,</span><span style=3D"color:#000">=
tag</span><span style=3D"color:#660"><</span><span style=3D"color:#080"=
>"name"</span><span style=3D"color:#660">,</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#008">string</span><span style=3D"c=
olor:#660">>>;</span></div></code></div><div>=C2=A0<br></div></div></=
div></blockquote><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"><=
div><div></div><div>Indeed,
I think this would be a much better solution. First, it allows you to have=
named_tuples with unnamed elements (`named_tuple<int, tag<"name=
", string>>`). Second, I think it makes it easier on the impleme=
ntation=20
side. For example, if you=20
want to write a metafunction that takes a `named_tuple<...>`=20
and generates a list of its types, you can do this:</div><div><br></div><di=
v style=3D"border:1px solid rgb(187,187,187);word-wrap:break-word;backgroun=
d-color:rgb(250,250,250)"><code><div><span style=3D"color:#008">template</s=
pan><span style=3D"color:#660"><</span><span style=3D"color:#008">typena=
me</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:#008">st=
ruct</span><span style=3D"color:#000"> get_type_from_tag<br></span><span st=
yle=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 </span><sp=
an style=3D"color:#008">using</span><span style=3D"color:#000"> type </span=
><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> T</span><=
span style=3D"color:#660">;</span><span style=3D"color:#000"><br></span><sp=
an 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"><</=
span><span style=3D"color:#008">const</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#008">char</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#660">*</span><span style=3D"color:#606">Str</span><=
span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><span =
style=3D"color:#008">typename</span><span style=3D"color:#000"> T</span><sp=
an style=3D"color:#660">></span><span style=3D"color:#000"><br></span><s=
pan style=3D"color:#008">struct</span><span style=3D"color:#000"> get_type_=
from_tag</span><span style=3D"color:#660"><</span><span style=3D"color:#=
000">tag</span><span style=3D"color:#660"><</span><span style=3D"color:#=
606">Str</span><span style=3D"color:#660">,</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><span style=3D"color:#000"><=
br>=C2=A0 </span><span style=3D"color:#008">using</span><span style=3D"colo=
r:#000"> type </span><span style=3D"color:#660">=3D</span><span style=3D"co=
lor:#000"> 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><br></span><span style=3D"color:#008">template</span><span style=
=3D"color:#660"><</span><span style=3D"color:#000">T</span><span style=
=3D"color:#660">></span><span style=3D"color:#000"><br></span><span styl=
e=3D"color:#008">using</span><span style=3D"color:#000"> get_type_from_tag_=
t </span><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> <=
/span><span style=3D"color:#008">typename</span><span style=3D"color:#000">=
get_type_from_tag</span><span style=3D"color:#660"><</span><span style=
=3D"color:#000">T</span><span style=3D"color:#660">>::</span><span style=
=3D"color:#000">type</span><span style=3D"color:#660">;</span><span style=
=3D"color:#000"><br><br></span><span style=3D"color:#008">template</span><s=
pan style=3D"color:#660"><</span><span style=3D"color:#008">typename</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#606">Tpl</span>=
<span style=3D"color:#660">></span><span style=3D"color:#000"><br></span=
><span style=3D"color:#008">struct</span><span style=3D"color:#000"> types_=
from_tuple </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"><</span><span style=3D"color:#008">typename</span><span =
style=3D"color:#000"> </span><span style=3D"color:#660">...</span><span sty=
le=3D"color:#606">Ts</span><span style=3D"color:#660">></span><span styl=
e=3D"color:#000"><br></span><span style=3D"color:#008">struct</span><span s=
tyle=3D"color:#000"> types_from_tuple</span><span style=3D"color:#660"><=
</span><span style=3D"color:#000">named_tuple</span><span style=3D"color:#6=
60"><</span><span style=3D"color:#606">T<wbr>s</span><span style=3D"colo=
r:#660">...>></span><span style=3D"color:#000"><br></span><span style=
=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 </span><span =
style=3D"color:#008">using</span><span style=3D"color:#000"> type </span><s=
pan style=3D"color:#660">=3D</span><span style=3D"color:#000"> type_list</s=
pan><span style=3D"color:#660"><</span><span style=3D"color:#000">get_ty=
pe_from_tag_t</span><span style=3D"color:#660"><</span><span style=3D"co=
lor:#606"><wbr>Ts</span><span style=3D"color:#660">>...>;</span><span=
style=3D"color:#000"><br></span><span style=3D"color:#660">};</span></div>=
</code></div><div><br></div><div>The metafunction for your code's equiv=
alent would not be able to use expansion like that. Since every pair of `T`=
in the argument list contains the actual type, you would need to use recur=
sion to extract the list of `T`s. Not the hardest thing in the world, but h=
ardly as straightforward as this.</div></div></div></blockquote><div><br></=
div><div>I agree that it can be expressed through type tagging. That being =
said do you think that such a solution could ever be part of std?</div></di=
v></blockquote><div><br></div><div>... why not?</div><div><br></div><div>Wh=
ether you use a tag type or your suggestion, it would be a very breaking ch=
ange to allow `std::tuple` itself to gain this feature. After all, people a=
lready have a lot of code that expects `tuple` to take only typenames, and =
that those typenames directly map to the types the `tuple` stores.</div><di=
v><br></div><div>So however it happens, it must be a new type. And there=
9;s no reason why the `tag`ed version couldn't be standardized.</div><d=
iv><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0;margin-lef=
t:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>=
This is an odd pattern that requires implementation knowledge on the part o=
f the user.</div></div></blockquote><div><br></div><div>No more odd than th=
e idea that you pass a sequence of string and type pairs. Certainly, no oth=
er type accepts such a thing at present.</div><div><br></div><div>By contra=
st, while the standard library doesn't use tagged template parameters, =
there are several C++ libraries that do. So at least some programmers are f=
amiliar with the concept.</div><div><br></div><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding=
-left:1ex"><div dir=3D"ltr"><div>On the implementation side I've worked=
on a non-recursive implementation that would rely on lambdas in unevaluate=
d context (also opted in C++20) and that I believe could also allow optiona=
l names.</div><div>That being said it is more difficult to write but librar=
y features are usually more difficult to write the more they wish to be eas=
y to use.</div></div></blockquote><div><br></div><div>I thought the whole p=
oint of this feature was to make template programming<i> easier</i>, not ha=
rder.</div></div></blockquote><div><br></div><div>Actually I said it was us=
eful and easier to use, not that it somehow made variadic templates easy to=
handle.</div></div></blockquote><div><br></div><div>Does C++ really need m=
ore ways to be hard to use?</div><div><i><br></i></div><blockquote class=3D=
"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc s=
olid;padding-left: 1ex;"><div dir=3D"ltr"><div>The point of this idea is to=
increase expressivity for the library writer and simplify its utilisation =
by the user.<br></div><div>As for the unevaluated lambdas, it is not requir=
ed at all but they have the benefit to be inaccessible for the user (as opp=
osed to tool classes/fn hidden in namespaces).</div><div><br></div><div>My =
issue with tagged types is that it's a fix not a solution.</div><div>It=
's a pattern where the user has to know a type and a tool type just to =
use it (two names required to express one idea).</div></div></blockquote><d=
iv><br></div><div>But it leads to better, more reasonable, and more easily =
understood code, for both the user and the library writer. If you see `tagg=
ed_tuple<tag<int, "name">>`, a user can make some gue=
sses about what's going on. But if you see `named_tuple<int, "n=
ame">`, you're not sure what's going on. There is no obviou=
s relationship between the type and the string.</div><div><br></div><div>Fu=
rthermore, I'm pretty sure the compile error given by `tagged_tuple<=
tag<"name", int>>` will be a lot easier to understand th=
an the one by `named_tuple<"name", int>`.</div><div><br></d=
iv><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"><div>I'=
;m aware that it is used by a bunch of libraries and the reason why they do=
so is because there are no alternatives (or they are even worse for the us=
er: decltype over overload function call, etc..).<br></div><div><br></div><=
div>Going back the the generic template parameter idea, generally speaking =
this idea has the same goals, consequences, etc..., as the "auto non-t=
ype parameter" proposal had.</div><div><br></div><div>On the named_tup=
le example, I believe that allowing a variable amount of strings after the =
type would make the tag implementation more difficult without really affect=
ing the "template" one.</div></div></blockquote><div><br></div><d=
iv>But that's only because the generic one is already such a nightmaris=
h beast to implement that it can't really get worse.<br></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/53e45e81-206a-4406-aa82-0e2bf798af96%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/53e45e81-206a-4406-aa82-0e2bf798af96=
%40isocpp.org</a>.<br />
------=_Part_31122_249712809.1513714576529--
------=_Part_31121_806240747.1513714576529--
.