Topic: Auto templates
Author: Douglas Boffey <douglas.boffey@gmail.com>
Date: Thu, 23 Oct 2014 05:02:33 -0700 (PDT)
Raw View
------=_Part_199_1243824113.1414065753553
Content-Type: text/plain; charset=UTF-8
We can currently have template type and template value parameters. We can
get the compiler to automatically infer the type for non-template variables
and constants. We can get template values that are of a type previously
given in the template parameter list using template <typename T, T V>.
It appears that the one thing that is missing is an automatically deduced
template value parameter.
What mileage would people see in having the following template declaration:
template <auto T> /* ... */
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_199_1243824113.1414065753553
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><DIV>We can currently have template type and template valu=
e parameters. We can get the compiler to automatically infer the type=
for non-template variables and constants. We can get template values=
that are of a type previously given in the template parameter list using t=
emplate <typename T, T V>.</DIV>
<DIV> </DIV>
<DIV>It appears that the one thing that is missing is an automatically dedu=
ced template value parameter.</DIV>
<DIV> </DIV>
<DIV>What mileage would people see in having the following template declara=
tion:</DIV>
<DIV> </DIV>
<DIV>
<DIV style=3D"BORDER-BOTTOM: #bbb 1px solid; BORDER-LEFT: #bbb 1px solid; B=
ACKGROUND-COLOR: #fafafa; WORD-WRAP: break-word; BORDER-TOP: #bbb 1px solid=
; BORDER-RIGHT: #bbb 1px solid" class=3Dprettyprint><CODE class=3Dprettypri=
nt>
<DIV class=3Dsubprettyprint><SPAN style=3D"COLOR: #008" class=3Dstyled-by-p=
rettify>template</SPAN><SPAN style=3D"COLOR: #000" class=3Dstyled-by-pretti=
fy> </SPAN><SPAN style=3D"COLOR: #660" class=3Dstyled-by-prettify><</SPA=
N><SPAN style=3D"COLOR: #008" class=3Dstyled-by-prettify>auto</SPAN><SPAN s=
tyle=3D"COLOR: #000" class=3Dstyled-by-prettify> T</SPAN><SPAN style=3D"COL=
OR: #660" class=3Dstyled-by-prettify>></SPAN><SPAN style=3D"COLOR: #000"=
class=3Dstyled-by-prettify> </SPAN><SPAN style=3D"COLOR: #800" class=3Dsty=
led-by-prettify>/* ... */</SPAN></DIV></CODE></DIV><BR></DIV></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_199_1243824113.1414065753553--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Thu, 23 Oct 2014 15:21:10 +0300
Raw View
On 23 October 2014 15:02, Douglas Boffey <douglas.boffey@gmail.com> wrote:
> We can currently have template type and template value parameters. We can
> get the compiler to automatically infer the type for non-template variables
> and constants. We can get template values that are of a type previously
> given in the template parameter list using template <typename T, T V>.
>
> It appears that the one thing that is missing is an automatically deduced
> template value parameter.
>
> What mileage would people see in having the following template declaration:
>
> template <auto T> /* ... */
1) what are the motivating use cases?
2) what is the impact on matching specialization declarations to main templates?
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
.
Author: Matheus Izvekov <mizvekov@gmail.com>
Date: Thu, 23 Oct 2014 17:03:14 -0700 (PDT)
Raw View
------=_Part_531_214370577.1414108994414
Content-Type: text/plain; charset=UTF-8
On Thursday, October 23, 2014 10:02:33 AM UTC-2, Douglas Boffey wrote:
>
> We can currently have template type and template value parameters. We can
> get the compiler to automatically infer the type for non-template variables
> and constants. We can get template values that are of a type previously
> given in the template parameter list using template <typename T, T V>.
>
> It appears that the one thing that is missing is an automatically deduced
> template value parameter.
>
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3601.html
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_531_214370577.1414108994414
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Thursday, October 23, 2014 10:02:33 AM UTC-2, Douglas B=
offey 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"><=
div>We can currently have template type and template value parameters. =
; We can get the compiler to automatically infer the type for non-template =
variables and constants. We can get template values that are of a typ=
e previously given in the template parameter list using template <typena=
me T, T V>.</div>
<div> </div>
<div>It appears that the one thing that is missing is an automatically dedu=
ced template value parameter.</div></div></blockquote><div><br>http://www.o=
pen-std.org/jtc1/sc22/wg21/docs/papers/2013/n3601.html<br></div></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_531_214370577.1414108994414--
.
Author: =?UTF-8?Q?Germ=C3=A1n_Diago?= <germandiago@gmail.com>
Date: Thu, 23 Oct 2014 21:59:30 -0700 (PDT)
Raw View
------=_Part_948_1534808092.1414126770788
Content-Type: text/plain; charset=UTF-8
>
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3601.html
>
You were faster than me :) I love that proposal.
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_948_1534808092.1414126770788
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><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"><div><br><a href=3D"http://www.open-std.org/jtc1/sc22/wg21/docs/pa=
pers/2013/n3601.html" target=3D"_blank" onmousedown=3D"this.href=3D'http://=
www.google.com/url?q\75http%3A%2F%2Fwww.open-std.org%2Fjtc1%2Fsc22%2Fwg21%2=
Fdocs%2Fpapers%2F2013%2Fn3601.html\46sa\75D\46sntz\0751\46usg\75AFQjCNGBXsR=
2s67viiZkWglLFCCyZktdFA';return true;" onclick=3D"this.href=3D'http://www.g=
oogle.com/url?q\75http%3A%2F%2Fwww.open-std.org%2Fjtc1%2Fsc22%2Fwg21%2Fdocs=
%2Fpapers%2F2013%2Fn3601.html\46sa\75D\46sntz\0751\46usg\75AFQjCNGBXsR2s67v=
iiZkWglLFCCyZktdFA';return true;">http://www.open-std.org/jtc1/<wbr>sc22/wg=
21/docs/papers/2013/<wbr>n3601.html</a></div></div></blockquote><div><br></=
div><div>You were faster than me :) I love that proposal.</div><div><br></d=
iv><div> </div></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_948_1534808092.1414126770788--
.
Author: Richard Smith <richard@metafoo.co.uk>
Date: Thu, 23 Oct 2014 18:11:20 -0700
Raw View
--001a1139d20ada01af050620db60
Content-Type: text/plain; charset=UTF-8
On Thu, Oct 23, 2014 at 5:03 PM, Matheus Izvekov <mizvekov@gmail.com> wrote:
> On Thursday, October 23, 2014 10:02:33 AM UTC-2, Douglas Boffey wrote:
>>
>> We can currently have template type and template value parameters. We
>> can get the compiler to automatically infer the type for non-template
>> variables and constants. We can get template values that are of a type
>> previously given in the template parameter list using template <typename T,
>> T V>.
>>
>> It appears that the one thing that is missing is an automatically deduced
>> template value parameter.
>>
>
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3601.html
>
The idea of using 'auto' instead of the syntax in that document has been
suggested by multiple people already; I think it's a vastly better choice.
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
--001a1139d20ada01af050620db60
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On T=
hu, Oct 23, 2014 at 5:03 PM, Matheus Izvekov <span dir=3D"ltr"><<a href=
=3D"mailto:mizvekov@gmail.com" target=3D"_blank">mizvekov@gmail.com</a>>=
</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .=
8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><span cla=
ss=3D"">On Thursday, October 23, 2014 10:02:33 AM UTC-2, Douglas Boffey wro=
te:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;bo=
rder-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>We can cur=
rently have template type and template value parameters.=C2=A0 We can get t=
he compiler to automatically infer the type for non-template variables and =
constants.=C2=A0 We can get template values that are of a type previously g=
iven in the template parameter list using template <typename T, T V>.=
</div>
<div>=C2=A0</div>
<div>It appears that the one thing that is missing is an automatically dedu=
ced template value parameter.</div></div></blockquote></span><div><br><a hr=
ef=3D"http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3601.html" t=
arget=3D"_blank">http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3=
601.html</a></div></div></blockquote><div><br></div><div>The idea of using =
'auto' instead of the syntax in that document has been suggested by=
multiple people already; I think it's a vastly better choice.</div></d=
iv></div></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--001a1139d20ada01af050620db60--
.
Author: Matheus Izvekov <mizvekov@gmail.com>
Date: Sat, 25 Oct 2014 17:41:10 -0700 (PDT)
Raw View
------=_Part_2299_77729360.1414284070951
Content-Type: text/plain; charset=UTF-8
On Saturday, October 25, 2014 12:32:46 PM UTC-2, Richard Smith wrote:
>
> The idea of using 'auto' instead of the syntax in that document has been
> suggested by multiple people already; I think it's a vastly better choice.
>
Yes, but it seems that it does not interact as well with concepts lite.
Suppose that you start with some code like:
template<auto V> struct foo { /*...*/ };
Now you decide that V should be constrained to be a value of an arithmetic
type.
The most natural way to express that would be:
template<Arithmetic V> struct foo { /*...*/ };
But now V is a type instead of a value... Looks quirky to me :-)
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_2299_77729360.1414284070951
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Saturday, October 25, 2014 12:32:46 PM UTC-2, Richard S=
mith 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"><d=
iv class=3D"gmail_quote"><div>The idea of using 'auto' instead of the synta=
x in that document has been suggested by multiple people already; I think i=
t's a vastly better choice.<br></div></div></div></blockquote><div><br></di=
v><div>Yes, but it seems that it does not interact as well with concepts li=
te.</div><div><br></div><div>Suppose that you start with some code like:</d=
iv><div><br></div><div><div class=3D"prettyprint" style=3D"border: 1px soli=
d rgb(187, 187, 187); word-wrap: break-word; background-color: rgb(250, 250=
, 250);"><code class=3D"prettyprint"><div class=3D"subprettyprint"><font co=
lor=3D"#660066"><span style=3D"color: #008;" class=3D"styled-by-prettify">t=
emplate</span><span style=3D"color: #660;" class=3D"styled-by-prettify"><=
;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">auto</spa=
n><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"styled-by-prettify"> </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">struct</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> foo </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: #800;" class=3D"styled-by=
-prettify">/*...*/</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">}=
;</span></font></div></code></div><br>Now you decide that V should be const=
rained to be a value of an arithmetic type.</div><div><br></div><div>The mo=
st natural way to express that would be:</div><div><br></div><div><div clas=
s=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap:=
break-word; background-color: rgb(250, 250, 250);"><code class=3D"prettypr=
int"><div class=3D"subprettyprint"><font color=3D"#660066"><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">template</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color: #6=
06;" class=3D"styled-by-prettify">Arithmetic</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> V</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">></span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> </span></font><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">struct</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> foo </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: #800;" 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></div></code=
></div><br>But now V is a type instead of a value... Looks quirky to me :-)=
</div></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_2299_77729360.1414284070951--
.
Author: =?UTF-8?Q?David_Rodr=C3=ADguez_Ibeas?= <dibeas@ieee.org>
Date: Sun, 26 Oct 2014 21:26:41 -0400
Raw View
--20cf301b6031442c6c05065d6cff
Content-Type: text/plain; charset=UTF-8
On Sat, Oct 25, 2014 at 8:41 PM, Matheus Izvekov <mizvekov@gmail.com> wrote:
> The most natural way to express that would be:
>
> template<Arithmetic V> struct foo { /*...*/ };
>
> But now V is a type instead of a value... Looks quirky to me :-)
>
> Could you not solve it with the less concise syntax?
template <auto V>
requires Arithmetic<decltype(V)>
struct foo { ... };
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
--20cf301b6031442c6c05065d6cff
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><div class=3D"gmail_extra"><br><div class=3D"gmail_quo=
te">On Sat, Oct 25, 2014 at 8:41 PM, Matheus Izvekov <span dir=3D"ltr"><=
<a href=3D"mailto:mizvekov@gmail.com" target=3D"_blank">mizvekov@gmail.com<=
/a>></span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:=
0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><d=
iv>The most natural way to express that would be:</div><div><br></div><div>=
<div style=3D"border:1px solid rgb(187,187,187);word-wrap:break-word;backgr=
ound-color:rgb(250,250,250)"><code><div><font color=3D"#660066"><span style=
=3D"color:#008">template</span><span style=3D"color:#660"><</span><span =
style=3D"color:#606">Arithmetic</span><span style=3D"color:#000"> V</span><=
span style=3D"color:#660">></span><span style=3D"color:#000"> </span></f=
ont><span style=3D"color:#008">struct</span><span style=3D"color:#000"> foo=
</span><span style=3D"color:#660">{</span><span style=3D"color:#000"> </sp=
an><span style=3D"color:#800">/*...*/</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#660">};</span></div></code></div><br>But now V is=
a type instead of a value... Looks quirky to me :-)</div></div><div class=
=3D"HOEnZb"><div class=3D"h5">
<p></p></div></div></blockquote></div></div><div class=3D"gmail_extra">Coul=
d you not solve it with the less concise syntax?</div><div class=3D"gmail_e=
xtra"><br></div><div class=3D"gmail_extra">template <auto V></div><di=
v class=3D"gmail_extra">requires Arithmetic<decltype(V)></div><div cl=
ass=3D"gmail_extra">struct foo { ... };</div></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--20cf301b6031442c6c05065d6cff--
.
Author: Matheus Izvekov <mizvekov@gmail.com>
Date: Sun, 26 Oct 2014 21:05:52 -0700 (PDT)
Raw View
------=_Part_624_1785401266.1414382752396
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Sunday, October 26, 2014 11:26:43 PM UTC-2, David Rodr=C3=ADguez Ibeas w=
rote:
>
> Could you not solve it with the less concise syntax?
>
> template <auto V>
> requires Arithmetic<decltype(V)>
> struct foo { ... };
>
Sure, I didn't say that there was no way to express that constraint with=20
the concepts lite syntax as is, just that it doesn't work without the=20
requires clause.
TBH If I had to fix one or the other, I'd choose to fix concepts lite. If I=
=20
see a template argument declaration like 'Integral V', I would expect V to=
=20
be a value, not a type, because it's closer to what current language rules=
=20
would imply.
But I don't know an alternative syntax that is just as plain and direct.
Anyway, I understand that type template parameters are way more common, and=
=20
so it makes sense to 'optimize' the syntax for them at the expense of value=
=20
parameters.
--=20
---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
------=_Part_624_1785401266.1414382752396
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Sunday, October 26, 2014 11:26:43 PM UTC-2, David Rodr=
=C3=ADguez Ibeas wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0=
;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div di=
r=3D"ltr"><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" styl=
e=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><d=
iv>
</div></div></blockquote></div><div>Could you not solve it with the less co=
ncise syntax?</div><div><br></div><div>template <auto V></div><div>re=
quires Arithmetic<decltype(V)></div><div>struct foo { ... };</div></d=
iv></blockquote><div><br>Sure, I didn't say that there was no way to expres=
s that constraint with the concepts lite syntax as is, just that it doesn't=
work without the requires clause.<br>TBH If I had to fix one or the other,=
I'd choose to fix concepts lite. If I see a template argument declaration =
like 'Integral V', I would expect V to be a value, not a type, because it's=
closer to what current language rules would imply.<br>But I don't know an =
alternative syntax that is just as plain and direct.<br>Anyway, I understan=
d that type template parameters are way more common, and so it makes sense =
to 'optimize' the syntax for them at the expense of value parameters.<br></=
div></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_624_1785401266.1414382752396--
.
Author: Edward Catmur <ed@catmur.co.uk>
Date: Mon, 27 Oct 2014 00:31:43 -0700 (PDT)
Raw View
------=_Part_3677_815897179.1414395103850
Content-Type: text/plain; charset=UTF-8
On Monday, 27 October 2014 04:05:52 UTC, Matheus Izvekov wrote:
>
> Sure, I didn't say that there was no way to express that constraint with
> the concepts lite syntax as is, just that it doesn't work without the
> requires clause.
>
How about a non-type constraint?
template<auto V> constexpr bool ArithmeticValue() { return Arithmetic<
decltype(V)>(); }
// ...
template<ArithmeticValue V> struct foo { /*...*/ };
I can't immediately think of a reason that couldn't work, obviously
dependent on concepts lite being written to allow it.
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_3677_815897179.1414395103850
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Monday, 27 October 2014 04:05:52 UTC, Matheus Izvekov =
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"><div>Su=
re, I didn't say that there was no way to express that constraint with the =
concepts lite syntax as is, just that it doesn't work without the requires =
clause.<br></div></div></blockquote><div><br></div><div>How about a non-typ=
e constraint?</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 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">auto</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> V</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: #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"style=
d-by-prettify">bool</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">=
ArithmeticValue</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">()</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">return</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #6=
06;" class=3D"styled-by-prettify">Arithmetic</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify"><</span><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">decltype</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify">V</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">)>();</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"><br></span><=
span style=3D"color: #800;" 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">template</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"co=
lor: #606;" class=3D"styled-by-prettify">ArithmeticValue</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> V</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: #008;" class=
=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> foo </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: #800;" class=3D"styled-by-prettify">/*.=
...*/</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: #000;" class=3D"styled-by-prettify"><br></span></div></code=
></div><div><br></div><div>I can't immediately think of a reason that could=
n't work, obviously dependent on concepts lite being written to allow it.</=
div></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_3677_815897179.1414395103850--
.
Author: Matheus Izvekov <mizvekov@gmail.com>
Date: Mon, 27 Oct 2014 03:35:42 -0700 (PDT)
Raw View
------=_Part_3131_851667672.1414406142872
Content-Type: text/plain; charset=UTF-8
On Monday, October 27, 2014 5:31:43 AM UTC-2, Edward Catmur wrote:
>
> How about a non-type constraint?
>
> template<auto V> constexpr bool ArithmeticValue() { return Arithmetic<
> decltype(V)>(); }
> // ...
> template<ArithmeticValue V> struct foo { /*...*/ };
>
> I can't immediately think of a reason that couldn't work, obviously
> dependent on concepts lite being written to allow it.
>
Well, it's not clear if this will be supported with concepts lite. But
anyway, that's still not as nice as expressing type parameter constraints,
not even close :-)
Point being, if concepts lite doesn't change to better accommodate
'template<auto', then it looks like the syntax proposed by N3601 will
integrate much better with it.
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_3131_851667672.1414406142872
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Monday, October 27, 2014 5:31:43 AM UTC-2, Edward Catmu=
r 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>=
How about a non-type constraint?<br></div><div><br></div><div style=3D"bord=
er:1px solid rgb(187,187,187);word-wrap:break-word;background-color:rgb(250=
,250,250)"><code><div><span style=3D"color:#008">template</span><span style=
=3D"color:#660"><</span><span style=3D"color:#008">auto</span><span styl=
e=3D"color:#000"> V</span><span style=3D"color:#660">></span><span style=
=3D"color:#000"> </span><span style=3D"color:#008">constexpr</span><span st=
yle=3D"color:#000"> </span><span style=3D"color:#008">bool</span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#606">ArithmeticValue</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 styl=
e=3D"color:#008">return</span><span style=3D"color:#000"> </span><span styl=
e=3D"color:#606">Arithmetic</span><span style=3D"color:#660"><</span><sp=
an style=3D"color:#008">decltype</span><span style=3D"color:#660">(</span><=
span style=3D"color:#000">V</span><span style=3D"color:#660">)>();</span=
><span style=3D"color:#000"> </span><span style=3D"color:#660">}</span><spa=
n style=3D"color:#000"><br></span><span style=3D"color:#800">// ...</span><=
span style=3D"color:#000"><br></span><span style=3D"color:#008">template</s=
pan><span style=3D"color:#660"><</span><span style=3D"color:#606">Arithm=
eticValue</span><span style=3D"color:#000"> V</span><span style=3D"color:#6=
60">></span><span style=3D"color:#000"> </span><span style=3D"color:#008=
">struct</span><span style=3D"color:#000"> foo </span><span style=3D"color:=
#660">{</span><span style=3D"color:#000"> </span><span style=3D"color:#800"=
>/*...*/</span><span style=3D"color:#000"> </span><span style=3D"color:#660=
">};</span><span style=3D"color:#000"><br></span></div></code></div><div><b=
r></div><div>I can't immediately think of a reason that couldn't work, obvi=
ously dependent on concepts lite being written to allow it.</div></div></bl=
ockquote><div><br></div><div>Well, it's not clear if this will be supported=
with concepts lite. But anyway, that's still not as nice as expressing typ=
e parameter constraints, not even close :-)</div><div><br></div><div>Point =
being, if concepts lite doesn't change to better accommodate 'template<a=
uto', then it looks like the syntax proposed by N3601 will integrate much b=
etter with it.</div></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_3131_851667672.1414406142872--
.
Author: Richard Smith <richard@metafoo.co.uk>
Date: Mon, 27 Oct 2014 11:52:06 -0700
Raw View
--089e0160ce82fa398b05066c0646
Content-Type: text/plain; charset=UTF-8
On Sat, Oct 25, 2014 at 5:41 PM, Matheus Izvekov <mizvekov@gmail.com> wrote:
> On Saturday, October 25, 2014 12:32:46 PM UTC-2, Richard Smith wrote:
>>
>> The idea of using 'auto' instead of the syntax in that document has been
>> suggested by multiple people already; I think it's a vastly better choice.
>>
>
> Yes, but it seems that it does not interact as well with concepts lite.
>
> Suppose that you start with some code like:
>
> template<auto V> struct foo { /*...*/ };
>
> Now you decide that V should be constrained to be a value of an arithmetic
> type.
>
> The most natural way to express that would be:
>
> template<Arithmetic V> struct foo { /*...*/ };
>
> But now V is a type instead of a value... Looks quirky to me :-)
>
That is a quirk inherent to concepts lite, not a quirk of this proposal.
Consider:
template<Arithmetic V> // V is a type
void f(V a, Arithmetic b); // b is a non-type
And then consider this oft-proposed extension to concepts lite:
template<typename T> concept Sequence = ...;
auto x = foo.getContents();
Sequence y = foo.getContents(); // like previous line, but with the type
constrained to be a Sequence
.... so this quirk will likely exist in contexts other than template
parameters.
I think concepts lite goes too far in trying to give a terse syntax, and
loses consistency as a result (it tries to use concept names as both types
and kinds, which is inherently doomed to this sort of issue). But that
consistency loss exists with or without this proposal.
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
--089e0160ce82fa398b05066c0646
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On S=
at, Oct 25, 2014 at 5:41 PM, Matheus Izvekov <span dir=3D"ltr"><<a href=
=3D"mailto:mizvekov@gmail.com" target=3D"_blank">mizvekov@gmail.com</a>>=
</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .=
8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><span cla=
ss=3D"">On Saturday, October 25, 2014 12:32:46 PM UTC-2, Richard Smith 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"><div class=3D"gm=
ail_quote"><div>The idea of using 'auto' instead of the syntax in t=
hat document has been suggested by multiple people already; I think it'=
s a vastly better choice.<br></div></div></div></blockquote><div><br></div>=
</span><div>Yes, but it seems that it does not interact as well with concep=
ts lite.</div><div><br></div><div>Suppose that you start with some code lik=
e:</div><div><br></div><div><div style=3D"border:1px solid rgb(187,187,187)=
;word-wrap:break-word;background-color:rgb(250,250,250)"><code><div><font c=
olor=3D"#660066"><span style=3D"color:#008">template</span><span style=3D"c=
olor:#660"><</span><span style=3D"color:#008">auto</span><span style=3D"=
color:#000"> V</span><span style=3D"color:#660">></span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#008">struct</span><span style=3D"c=
olor:#000"> foo </span><span style=3D"color:#660">{</span><span style=3D"co=
lor:#000"> </span><span style=3D"color:#800">/*...*/</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#660">};</span></font></div></code>=
</div><br>Now you decide that V should be constrained to be a value of an a=
rithmetic type.</div><div><br></div><div>The most natural way to express th=
at would be:</div><div><br></div><div><div style=3D"border:1px solid rgb(18=
7,187,187);word-wrap:break-word;background-color:rgb(250,250,250)"><code><d=
iv><font color=3D"#660066"><span style=3D"color:#008">template</span><span =
style=3D"color:#660"><</span><span style=3D"color:#606">Arithmetic</span=
><span style=3D"color:#000"> V</span><span style=3D"color:#660">></span>=
<span style=3D"color:#000"> </span></font><span style=3D"color:#008">struct=
</span><span style=3D"color:#000"> foo </span><span style=3D"color:#660">{<=
/span><span style=3D"color:#000"> </span><span style=3D"color:#800">/*...*/=
</span><span style=3D"color:#000"> </span><span style=3D"color:#660">};</sp=
an></div></code></div><br>But now V is a type instead of a value... Looks q=
uirky to me :-)</div></div></blockquote><div><br></div><div>That is a quirk=
inherent to concepts lite, not a quirk of this proposal. Consider:</div><d=
iv><br></div><div>=C2=A0 template<Arithmetic V> // V is a type</div><=
div>=C2=A0 void f(V a, Arithmetic b); // b is a non-type</div><div><br></di=
v><div>And then consider this oft-proposed extension to concepts lite:</div=
><div><br></div><div>=C2=A0 template<typename T> concept Sequence =3D=
...;</div><div><br></div><div>=C2=A0 auto x =3D foo.getContents();</div><d=
iv>=C2=A0 Sequence y =3D foo.getContents(); // like previous line, but with=
the type constrained to be a Sequence</div><div><br></div><div>... so this=
quirk will likely exist in contexts other than template parameters.</div><=
div><br></div><div>I think concepts lite goes too far in trying to give a t=
erse syntax, and loses consistency as a result (it tries to use concept nam=
es as both types and kinds, which is inherently doomed to this sort of issu=
e). But that consistency loss exists with or without this proposal.</div></=
div></div></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--089e0160ce82fa398b05066c0646--
.
Author: Matheus Izvekov <mizvekov@gmail.com>
Date: Mon, 27 Oct 2014 12:19:58 -0700 (PDT)
Raw View
------=_Part_2005_1780521642.1414437598275
Content-Type: text/plain; charset=UTF-8
On Monday, October 27, 2014 4:52:08 PM UTC-2, Richard Smith wrote:
>
> That is a quirk inherent to concepts lite, not a quirk of this proposal.
> Consider:
>
> template<Arithmetic V> // V is a type
> void f(V a, Arithmetic b); // b is a non-type
>
> And then consider this oft-proposed extension to concepts lite:
>
> template<typename T> concept Sequence = ...;
>
> auto x = foo.getContents();
> Sequence y = foo.getContents(); // like previous line, but with the type
> constrained to be a Sequence
>
> ... so this quirk will likely exist in contexts other than template
> parameters.
>
> I think concepts lite goes too far in trying to give a terse syntax, and
> loses consistency as a result (it tries to use concept names as both types
> and kinds, which is inherently doomed to this sort of issue). But that
> consistency loss exists with or without this proposal.
>
Yeah I agree, thought it feels like the 'template<auto' proposal adds even
more to that consistency issue. You lose all that terseness when trying to
constrain the type of template value parameters.
So it's in that sense that I had the opinion that, if concepts lite were
accepted with the same syntax as right now, then N3601 would be a more
consistent candidate.
I am outside the loop though to know if there have been counter proposals
to fix this consistency issue.
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_2005_1780521642.1414437598275
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Monday, October 27, 2014 4:52:08 PM UTC-2, Richard Smit=
h 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 =
class=3D"gmail_quote"><div>That is a quirk inherent to concepts lite, not a=
quirk of this proposal. Consider:<br></div><div><br></div><div> temp=
late<Arithmetic V> // V is a type</div><div> void f(V a, Arithm=
etic b); // b is a non-type</div><div><br></div><div>And then consider this=
oft-proposed extension to concepts lite:</div><div><br></div><div> t=
emplate<typename T> concept Sequence =3D ...;</div><div><br></div><di=
v> auto x =3D foo.getContents();</div><div> Sequence y =3D foo.=
getContents(); // like previous line, but with the type constrained to be a=
Sequence</div><div><br></div><div>... so this quirk will likely exist in c=
ontexts other than template parameters.</div><div><br></div><div>I think co=
ncepts lite goes too far in trying to give a terse syntax, and loses consis=
tency as a result (it tries to use concept names as both types and kinds, w=
hich is inherently doomed to this sort of issue). But that consistency loss=
exists with or without this proposal.</div></div></div></blockquote><div><=
br></div><div>Yeah I agree, thought it feels like the 'template<auto' pr=
oposal adds even more to that consistency issue. You lose all that tersenes=
s when trying to constrain the type of template value parameters.</div><div=
><br></div><div>So it's in that sense that I had the opinion that, if conce=
pts lite were accepted with the same syntax as right now, then N3601 would =
be a more consistent candidate.</div><div><br></div><div>I am outside the l=
oop though to know if there have been counter proposals to fix this consist=
ency issue.</div></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_2005_1780521642.1414437598275--
.
Author: inkwizytoryankes@gmail.com
Date: Tue, 28 Oct 2014 14:27:39 -0700 (PDT)
Raw View
------=_Part_867_885079379.1414531659775
Content-Type: text/plain; charset=UTF-8
This change will help handling variant value parameters of template:
template<int I> class A { };
template<int foo::* P, int J> class B { };
template<template<auto... A> class W> class C { };
C<A> f;
C<B> g;
I think it even should be push even further and have new param that
represents value and type:
template<using X>
class Z
{
//you can't use X here directly because it can be value or type, you
can only send it to another template.
typedef K<X> someType;
};
template<auto V>
class Z<V>
{
//now X is value
};
template<int I>
class Z<I>
{
//now X is value of int
};
template<typename T>
class Z<T>
{
//now X is type
};
This will allow create generic meta algorithms on templates like
`std::array`:
template<template<using...> class X, using... Y>
using Apply = X<Y...>;
Apply<std::array, int, 5> arr; // == std::array<int, 5>
On Thursday, October 23, 2014 2:21:12 PM UTC+2, Ville Voutilainen wrote:
>
> On 23 October 2014 15:02, Douglas Boffey <douglas...@gmail.com
> <javascript:>> wrote:
> > We can currently have template type and template value parameters. We
> can
> > get the compiler to automatically infer the type for non-template
> variables
> > and constants. We can get template values that are of a type previously
> > given in the template parameter list using template <typename T, T V>.
> >
> > It appears that the one thing that is missing is an automatically
> deduced
> > template value parameter.
> >
> > What mileage would people see in having the following template
> declaration:
> >
> > template <auto T> /* ... */
>
>
> 1) what are the motivating use cases?
> 2) what is the impact on matching specialization declarations to main
> templates?
>
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_867_885079379.1414531659775
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">This change will help handling variant value parameters of=
template:<br><div class=3D"prettyprint" style=3D"background-color: rgb(250=
, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-=
width: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div class=
=3D"subprettyprint"><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">tem=
plate</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: #000;" class=3D"styled-by-prettify"> I</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"> A </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: #000;" class=3D"styled-by-prettify"><b=
r></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">int</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> foo</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">::*</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> P</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">int</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> J</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
></span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #008;" class=3D"styled-by-prettify">class</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> B </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: #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">template</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify"><</span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">template</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify"><</span><span style=3D"color: #008;" class=3D"styled-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"> A</span><s=
pan 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">class</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> W</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">></span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">class</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> C </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: #000;" class=3D"styled-by-prettify"><br>C</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify"><</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">A</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">></span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> f</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>C</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy"><</span><span style=3D"color: #000;" class=3D"styled-by-prettify">B<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">></span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> g</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></span></div></code></div>=
<br><br>I think it even should be push even further and have new param that=
represents value and type:<br><br><div class=3D"prettyprint" style=3D"back=
ground-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-=
style: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"pre=
ttyprint"><div class=3D"subprettyprint"><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"st=
yled-by-prettify">using</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> X</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: #008;" class=3D"styled-by-prettify">class</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> Z<br></span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br> </span>=
<span style=3D"color: #800;" class=3D"styled-by-prettify">//you can't use X=
here directly because it can be value or type, you can only send it to ano=
ther template.</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"><br> </span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">typedef</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> K</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
><</span><span style=3D"color: #000;" class=3D"styled-by-prettify">X</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">></span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> someType</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">};</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">template</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: #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: #008;" class=3D"styled-by-prettify">class</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> Z</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify">V</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> </span><span style=3D"color: #800;" cl=
ass=3D"styled-by-prettify">//now X is value</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><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br></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-prett=
ify">int</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"><br></span><span=
style=3D"color: #008;" class=3D"styled-by-prettify">class</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> Z</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify">I</span><span style=3D"color: #660;" clas=
s=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-pretti=
fy"><br> </span><span style=3D"color: #800;" class=3D"styled-b=
y-prettify">//now X is value of int</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></span><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">template</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y"><</span><span style=3D"color: #008;" class=3D"styled-by-prettify">typ=
ename</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> T</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></span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">class</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> Z</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify"><</span><span style=3D"color: #00=
0;" 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: #660;" class=3D"styled-b=
y-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br> </span><span style=3D"color: #800;" class=3D"styled-by=
-prettify">//now X is type</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><br></span></div></code></div><br><br>This will allow create generic =
meta algorithms on templates like `std::array`:<br><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: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">template</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify"><</span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">template</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify"><</span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">using</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"> X</=
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">using</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">...</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> Y</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">></span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">using</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify"=
>Apply</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><sp=
an 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"co=
lor: #000;" class=3D"styled-by-prettify">Y</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">...>;</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #606;" c=
lass=3D"styled-by-prettify">Apply</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify"><</span><span style=3D"color: #000;" class=3D"st=
yled-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">array</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">int</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">5</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">></span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> arr</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: #800;" class=3D"styled-by-prettify">// =3D=3D=
std::array<int, 5></span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br><br><br></span></div></code></div><br><br><br>On Thursda=
y, October 23, 2014 2:21:12 PM UTC+2, Ville Voutilainen wrote:<blockquote c=
lass=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px=
#ccc solid;padding-left: 1ex;">On 23 October 2014 15:02, Douglas Boffey &l=
t;<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"qui1Jh=
DeKksJ" onmousedown=3D"this.href=3D'javascript:';return true;" onclick=3D"t=
his.href=3D'javascript:';return true;">douglas...@gmail.com</a>> wrote:
<br>> We can currently have template type and template value parameters.=
We can
<br>> get the compiler to automatically infer the type for non-template =
variables
<br>> and constants. We can get template values that are of a type=
previously
<br>> given in the template parameter list using template <typename T=
, T V>.
<br>>
<br>> It appears that the one thing that is missing is an automatically =
deduced
<br>> template value parameter.
<br>>
<br>> What mileage would people see in having the following template dec=
laration:
<br>>
<br>> template <auto T> /* ... */
<br>
<br>
<br>1) what are the motivating use cases?
<br>2) what is the impact on matching specialization declarations to main t=
emplates?
<br></blockquote></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_867_885079379.1414531659775--
.
Author: Peter Koch Larsen <peter.koch.larsen@gmail.com>
Date: Tue, 28 Oct 2014 17:18:55 -0700 (PDT)
Raw View
------=_Part_5989_1580665758.1414541936043
Content-Type: text/plain; charset=UTF-8
Den torsdag den 23. oktober 2014 14.21.12 UTC+2 skrev Ville Voutilainen:
>
> On 23 October 2014 15:02, Douglas Boffey <douglas...@gmail.com
> <javascript:>> wrote:
> > We can currently have template type and template value parameters. We
> can
> > get the compiler to automatically infer the type for non-template
> variables
> > and constants. We can get template values that are of a type previously
> > given in the template parameter list using template <typename T, T V>.
> >
> > It appears that the one thing that is missing is an automatically
> deduced
> > template value parameter.
> >
> > What mileage would people see in having the following template
> declaration:
> >
> > template <auto T> /* ... */
>
>
> 1) what are the motivating use cases?
> 2) what is the impact on matching specialization declarations to main
> templates?
>
I just found this inquiry and I can provide you with one more use-case. I
do not know
if it is a motivating example, but auto templates would surely help me a
lot.
The background:
I a producing a system based on existing specifications (in ASN.1), where
there are literally hundreds of types structures that for the most part can
be modeled as either tuples or variants (I have written my own tuple and
variant class as my primary compiler choked when it was given a tuple with
more than 200 elements).
The ASN.1 specification is converted to tuples and other datastructures
semiautomatically, and this generally works nicely as most of the code is
templated so I do not need to do much work when e.g. serialising or
displaying on of my ASN.1 types. One central piece in my code is a visitor,
that for a tuple checks each individual element and performs a given
action. This could be a serialisation, but it could also be a static
visitor where I do not have an instance of my class. The static visitor is
used e.g. when I determine the layout of a tuple on a screen. In total I
have six visitors: a const, a non-const and a static one and the same three
with a predicate for visiting the member in the first place.
My problem is that I for a few of these classes have to write some glue in
order to check the semantics of my program.
As I use the same interface as for tuple (using get<>) to access the
individual member this code becomes unreadable very fast and for those few
(~10) classes I would like to handcraft the code using a template for
visiting in the style of:
template<my_class,auto... values> struct visitor_trait { define the six
visitor-functions; };
where the values parameters represent one member-pointer for that class.
This is not possible and I have ended up with a kludge that works by
defining a variable (created via a make_xxx function that Works similarly
to std::make_tuple.
So for me auto template (supporting a variable number of variables) would
be a great solution.
/Peter
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_5989_1580665758.1414541936043
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>Den torsdag den 23. oktober 2014 14.21.12 UTC+2 sk=
rev Ville Voutilainen:<blockquote class=3D"gmail_quote" style=3D"margin: 0p=
x 0px 0px 0.8ex; padding-left: 1ex; border-left-color: rgb(204, 204, 204); =
border-left-width: 1px; border-left-style: solid;">On 23 October 2014 15:02=
, Douglas Boffey <<a onmousedown=3D"this.href=3D'javascript:';return tru=
e;" onclick=3D"this.href=3D'javascript:';return true;" href=3D"javascript:"=
target=3D"_blank" gdf-obfuscated-mailto=3D"qui1JhDeKksJ">douglas...@gmail.=
com</a>> wrote:
<br>> We can currently have template type and template value parameters.=
We can
<br>> get the compiler to automatically infer the type for non-template =
variables
<br>> and constants. We can get template values that are of a type=
previously
<br>> given in the template parameter list using template <typename T=
, T V>.
<br>>
<br>> It appears that the one thing that is missing is an automatically =
deduced
<br>> template value parameter.
<br>>
<br>> What mileage would people see in having the following template dec=
laration:
<br>>
<br>> template <auto T> /* ... */
<br>
<br>
<br>1) what are the motivating use cases?
<br>2) what is the impact on matching specialization declarations to main t=
emplates?
<br></blockquote><div><br></div><div><br></div><div>I just found this  =
;inquiry and I can provide you with one more use-case. I do not know </div>=
<div>if it is a motivating example, but auto templates would surely help me=
a lot.</div><div>The background: </div><div>I a producing a system based o=
n existing specifications (in ASN.1), where there are literally hundreds of=
types structures that for the most part can be modeled as either tuples or=
variants (I have written my own tuple and variant class as my primary comp=
iler choked when it was given a tuple with more than 200 elements).</div><d=
iv>The ASN.1 specification is converted to tuples and other datastructures =
semiautomatically, and this generally works nicely as most of the code is t=
emplated so I do not need to do much work when e.g. serialising or displayi=
ng on of my ASN.1 types. One central piece in my code is a visitor, that fo=
r a tuple checks each individual element and performs a given action. This =
could be a serialisation, but it could also be a static visitor where I do =
not have an instance of my class. The static visitor is used e.g. when I de=
termine the layout of a tuple on a screen. In total I have six visitors: a =
const, a non-const and a static one and the same three with a predicate for=
visiting the member in the first place.</div><div>My problem is that I for=
a few of these classes have to write some glue in order to check the seman=
tics of my program.</div><div>As I use the same interface as for tuple (usi=
ng get<>) to access the individual member this code becomes unreadabl=
e very fast and for those few (~10) classes I would like to handcraft the c=
ode using a template for visiting in the style of:</div><div>template<my=
_class,auto... values> struct visitor_trait { define the six visitor-fun=
ctions; };</div><div>where the values parameters represent one member-point=
er for that class. </div><div>This is not possible and I have ended up with=
a kludge that works by defining a variable (created via a make_xxx functio=
n that Works similarly to std::make_tuple. </div><div>So for me auto templa=
te (supporting a variable number of variables) would be a great solution.</=
div><div><br></div><div>/Peter</div></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_5989_1580665758.1414541936043--
.