Topic: Implicit function template arguments enabling
Author: Tom Honermann <tom@honermann.net>
Date: Wed, 7 Sep 2016 11:17:32 -0400
Raw View
This is a multi-part message in MIME format.
--------------5B682552D136A33F0B193177
Content-Type: text/plain; charset=UTF-8; format=flowed
On 9/7/2016 10:01 AM, Ivan G. wrote:
> How about the following function template syntax? An ellipsis in the
> end of template argument list would allow the function template to use
> extended functionality as generic lambdas of C++14 and possibly Concepts.
>
> template <...>
> void foo(auto x)
> {
> }
>
> template <typename T,...>
> void bar(T x, auto y = 42)
> {
> }
>
> foo(42); // OK
> foo<int>(42); // Error?
> bar(42); // OK
> bar<int>(42); // OK
> bar<int, int>(42); // Error?
>
> I heard abbreviated templates from Concepts were criticized in related
> way. This would make the difference between plain functions and
> function templates more clear. Sorry if this has already been discussed.
I favor the above syntax over the existing design in the Concepts TS. I
have seen this syntax briefly discussed, but I'm not aware of a thorough
analysis. I think it would be great if someone (hint hint) wrote a
paper proposing it.
I think the "Error?" cases should be errors since nothing in the
declaration creates an obvious connection between the deduced parameter
type and the corresponding invented template parameter. The rules in the
Concepts TS are clear on how this would work, but the association is
fragile.
For anyone wanting to revisit prior discussions regarding the design in
the Concepts TS, review this thread:
-
https://groups.google.com/a/isocpp.org/d/topic/std-proposals/PaKP8EIIlEU/discussion
My primary concerns expressed in that thread are here:
-
https://groups.google.com/a/isocpp.org/d/msg/std-proposals/PaKP8EIIlEU/xxhkPZrdnwoJ
Tom.
--
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/1db9b26d-f93f-d73a-446b-890507e602d7%40honermann.net.
--------------5B682552D136A33F0B193177
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
</head>
<body bgcolor=3D"#FFFFFF" text=3D"#000000">
<div class=3D"moz-cite-prefix">On 9/7/2016 10:01 AM, Ivan G. wrote:<br>
</div>
<blockquote
cite=3D"mid:627640bf-62bf-491e-bea9-f76eec0033ec@isocpp.org"
type=3D"cite">
<div dir=3D"ltr">
<div>How about the following function template syntax? An
ellipsis in the end of template argument list would allow the
function template to use extended functionality as generic
lambdas of C++14 and possibly Concepts.<br>
</div>
<div><br>
</div>
<div><font face=3D"courier new,monospace">template <...></fon=
t></div>
<div><font face=3D"courier new,monospace">void foo(auto x)<br>
</font></div>
<div><font face=3D"courier new,monospace">{<br>
</font></div>
<div><font face=3D"courier new,monospace">}<br>
</font></div>
<div><font face=3D"courier new,monospace"><br>
</font></div>
<div><font face=3D"courier new,monospace">template <typename
T,...><br>
</font></div>
<div><font face=3D"courier new,monospace">void bar(T x, auto y =3D
42)<br>
</font></div>
<div><font face=3D"courier new,monospace">{<br>
</font></div>
<div><font face=3D"courier new,monospace">}<br>
</font></div>
<div><font face=3D"courier new,monospace"><br>
</font></div>
<div><font face=3D"courier new,monospace">foo(42); // OK<br>
</font></div>
<div><font face=3D"courier new,monospace">foo<int>(42); //
Error?<br>
</font></div>
<div><font face=3D"courier new,monospace">bar(42); // OK<br>
</font></div>
<div><font face=3D"courier new,monospace">bar<int>(42); //
OK<br>
</font></div>
<div><font face=3D"courier new,monospace">bar<int, int>(42);
// Error?<br>
</font></div>
<div><br>
</div>
<div>I heard abbreviated templates from Concepts were criticized
in related way. This would make the difference between plain
functions and function templates more clear. Sorry if this has
already been discussed.</div>
</div>
</blockquote>
<br>
I favor the above syntax over the existing design in the Concepts
TS.=C2=A0 I have seen this syntax briefly discussed, but I'm not aware =
of
a thorough analysis.=C2=A0 I think it would be great if someone (hint
hint) wrote a paper proposing it.<br>
<br>
I think the "Error?" cases should be errors since nothing in the
declaration creates an obvious connection between the deduced
parameter type and the corresponding invented template parameter.=C2=A0
The rules in the Concepts TS are clear on how this would work, but
the association is fragile.<br>
<br>
For anyone wanting to revisit prior discussions regarding the design
in the Concepts TS, review this thread:<br>
-
<a class=3D"moz-txt-link-freetext" href=3D"https://groups.google.com/a/isoc=
pp.org/d/topic/std-proposals/PaKP8EIIlEU/discussion">https://groups.google.=
com/a/isocpp.org/d/topic/std-proposals/PaKP8EIIlEU/discussion</a><br>
<br>
My primary concerns expressed in that thread are here:<br>
-
<a class=3D"moz-txt-link-freetext" href=3D"https://groups.google.com/a/isoc=
pp.org/d/msg/std-proposals/PaKP8EIIlEU/xxhkPZrdnwoJ">https://groups.google.=
com/a/isocpp.org/d/msg/std-proposals/PaKP8EIIlEU/xxhkPZrdnwoJ</a><br>
<br>
Tom.<br>
</body>
</html>
<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/1db9b26d-f93f-d73a-446b-890507e602d7%=
40honermann.net?utm_medium=3Demail&utm_source=3Dfooter">https://groups.goog=
le.com/a/isocpp.org/d/msgid/std-proposals/1db9b26d-f93f-d73a-446b-890507e60=
2d7%40honermann.net</a>.<br />
--------------5B682552D136A33F0B193177--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Wed, 7 Sep 2016 09:26:07 -0700 (PDT)
Raw View
------=_Part_664_126651656.1473265567361
Content-Type: multipart/alternative;
boundary="----=_Part_665_1568575917.1473265567361"
------=_Part_665_1568575917.1473265567361
Content-Type: text/plain; charset=UTF-8
On Wednesday, September 7, 2016 at 10:01:19 AM UTC-4, Ivan G. wrote:
>
> How about the following function template syntax? An ellipsis in the end
> of template argument list would allow the function template to use extended
> functionality as generic lambdas of C++14 and possibly Concepts.
>
I'm not sure I understand what the point of the `...` part is.
One of the primary problems (to me) with the fully terse template function
syntax is that it declares a template function without telling the user
that they've done that. So it seems to me that it is enough to simply use
the `template` keyword:
template<>
void foo(auto x);
I just don't see a real need to have the `...` there, just to say that the
parameter list will also add template arguments. That can be implicit.
--
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/d114cdd9-77c1-43ce-8fdd-522422234155%40isocpp.org.
------=_Part_665_1568575917.1473265567361
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Wednesday, September 7, 2016 at 10:01:19 AM UTC-4, Ivan=
G. 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"><di=
v>How about the following function template syntax? An ellipsis in the end =
of template argument list would allow the function template to use extended=
functionality as generic lambdas of C++14 and possibly Concepts.<br></div>=
</div></blockquote><div><br>I'm not sure I understand what the point of=
the `...` part is.<br><br>One of the primary problems (to me) with the ful=
ly terse template function syntax is that it declares a template function w=
ithout telling the user that they've done that. So it seems to me that =
it is enough to simply use the `template` keyword:<br><br><div class=3D"pre=
ttyprint" style=3D"background-color: rgb(250, 250, 250); border-color: rgb(=
187, 187, 187); border-style: solid; border-width: 1px; word-wrap: break-wo=
rd;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=
=3D"color: #008;" class=3D"styled-by-prettify">template</span><span style=
=3D"color: #660;" class=3D"styled-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">void</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> foo</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">(</span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">auto</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> x</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></div></code></div><br>I just don't see a real need to have th=
e `...` there, just to say that the parameter list will also add template a=
rguments. That can be implicit.</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/d114cdd9-77c1-43ce-8fdd-522422234155%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/d114cdd9-77c1-43ce-8fdd-522422234155=
%40isocpp.org</a>.<br />
------=_Part_665_1568575917.1473265567361--
------=_Part_664_126651656.1473265567361--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Wed, 7 Sep 2016 09:27:38 -0700 (PDT)
Raw View
------=_Part_673_736229965.1473265659035
Content-Type: multipart/alternative;
boundary="----=_Part_674_1892254954.1473265659035"
------=_Part_674_1892254954.1473265659035
Content-Type: text/plain; charset=UTF-8
On Wednesday, September 7, 2016 at 11:17:38 AM UTC-4, Tom Honermann wrote:
>
> On 9/7/2016 10:01 AM, Ivan G. wrote:
>
> How about the following function template syntax? An ellipsis in the end
> of template argument list would allow the function template to use extended
> functionality as generic lambdas of C++14 and possibly Concepts.
>
> template <...>
> void foo(auto x)
> {
> }
>
> template <typename T,...>
> void bar(T x, auto y = 42)
> {
> }
>
> foo(42); // OK
> foo<int>(42); // Error?
> bar(42); // OK
> bar<int>(42); // OK
> bar<int, int>(42); // Error?
>
> I heard abbreviated templates from Concepts were criticized in related
> way. This would make the difference between plain functions and function
> templates more clear. Sorry if this has already been discussed.
>
>
> I favor the above syntax over the existing design in the Concepts TS. I
> have seen this syntax briefly discussed, but I'm not aware of a thorough
> analysis. I think it would be great if someone (hint hint) wrote a paper
> proposing it.
>
> I think the "Error?" cases should be errors since nothing in the
> declaration creates an obvious connection between the deduced parameter
> type and the corresponding invented template parameter. The rules in the
> Concepts TS are clear on how this would work, but the association is
> fragile.
>
I strongly disagree with that. A terse template function is not a special,
magical construct. It is a *template function*, and it should act like a
template function. If it is legal to explicitly specify a template
function's template parameters, then it should be legal to do so if it uses
terse syntax, even for the parameters.
We can get a function pointer to a specific instantiation of a template
function. With what you're saying, it would be impossible to do so with a
terse template.
There should be no observable difference between:
template<typename T> void func1(T&& t);
and
template<> void func1(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.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/58af8b26-b913-4f2f-a8df-5f69baa733b9%40isocpp.org.
------=_Part_674_1892254954.1473265659035
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Wednesday, September 7, 2016 at 11:17:38 AM UTC-4, Tom =
Honermann wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin=
-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
=20
=20
=20
<div bgcolor=3D"#FFFFFF" text=3D"#000000">
<div>On 9/7/2016 10:01 AM, Ivan G. wrote:<br>
</div>
<blockquote type=3D"cite">
<div dir=3D"ltr">
<div>How about the following function template syntax? An
ellipsis in the end of template argument list would allow the
function template to use extended functionality as generic
lambdas of C++14 and possibly Concepts.<br>
</div>
<div><br>
</div>
<div><font face=3D"courier new,monospace">template <...></fon=
t></div>
<div><font face=3D"courier new,monospace">void foo(auto x)<br>
</font></div>
<div><font face=3D"courier new,monospace">{<br>
</font></div>
<div><font face=3D"courier new,monospace">}<br>
</font></div>
<div><font face=3D"courier new,monospace"><br>
</font></div>
<div><font face=3D"courier new,monospace">template <typename
T,...><br>
</font></div>
<div><font face=3D"courier new,monospace">void bar(T x, auto y =3D
42)<br>
</font></div>
<div><font face=3D"courier new,monospace">{<br>
</font></div>
<div><font face=3D"courier new,monospace">}<br>
</font></div>
<div><font face=3D"courier new,monospace"><br>
</font></div>
<div><font face=3D"courier new,monospace">foo(42); // OK<br>
</font></div>
<div><font face=3D"courier new,monospace">foo<int>(42); //
Error?<br>
</font></div>
<div><font face=3D"courier new,monospace">bar(42); // OK<br>
</font></div>
<div><font face=3D"courier new,monospace">bar<int>(42); //
OK<br>
</font></div>
<div><font face=3D"courier new,monospace">bar<int, int>(42);
// Error?<br>
</font></div>
<div><br>
</div>
<div>I heard abbreviated templates from Concepts were criticized
in related way. This would make the difference between plain
functions and function templates more clear. Sorry if this has
already been discussed.</div>
</div>
</blockquote>
<br>
I favor the above syntax over the existing design in the Concepts
TS.=C2=A0 I have seen this syntax briefly discussed, but I'm not aw=
are of
a thorough analysis.=C2=A0 I think it would be great if someone (hint
hint) wrote a paper proposing it.<br>
<br>
I think the "Error?" cases should be errors since nothing in =
the
declaration creates an obvious connection between the deduced
parameter type and the corresponding invented template parameter.=C2=A0
The rules in the Concepts TS are clear on how this would work, but
the association is fragile.<br></div></blockquote><div><br>I strongly d=
isagree with that. A terse template function is not a special, magical cons=
truct. It is a <i>template function</i>, and it should act like a template =
function. If it is legal to explicitly specify a template function's te=
mplate parameters, then it should be legal to do so if it uses terse syntax=
, even for the parameters.<br><br>We can get a function pointer to a specif=
ic instantiation of a template function. With what you're saying, it wo=
uld be impossible to do so with a terse template.<br><br>There should be no=
observable difference between:<br><br>template<typename T> void func=
1(T&& t);<br><br>and<br><br>template<> void func1(auto&&a=
mp; t);<br></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/58af8b26-b913-4f2f-a8df-5f69baa733b9%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/58af8b26-b913-4f2f-a8df-5f69baa733b9=
%40isocpp.org</a>.<br />
------=_Part_674_1892254954.1473265659035--
------=_Part_673_736229965.1473265659035--
.
Author: "Ivan G." <nekotekina@gmail.com>
Date: Wed, 7 Sep 2016 10:13:26 -0700 (PDT)
Raw View
------=_Part_3826_358006987.1473268406237
Content-Type: multipart/alternative;
boundary="----=_Part_3827_1945114200.1473268406237"
------=_Part_3827_1945114200.1473268406237
Content-Type: text/plain; charset=UTF-8
Thanks for the answers! I'll correct the syntax a bit.
> I'm not sure I understand what the point of the `...` part is.
>
> One of the primary problems (to me) with the fully terse template function
> syntax is that it declares a template function without telling the user
> that they've done that. So it seems to me that it is enough to simply use
> the `template` keyword:
>
> template<>
> void foo(auto x);
>
> I just don't see a real need to have the `...` there, just to say that the
> parameter list will also add template arguments. That can be implicit.
>
AFAIK plain template<> syntax is already used for explicit function
template specializations. Forgive me if I'm wrong, but such a
specialization is not considered a template but rather a function.
template <..., typename T>
void foo2(T x, auto y)
{
}
foo2<int>(42, 42); // OK
foo2<bool, int>(42, false); // OK
If explicit template parameters are allowed for auto arguments, then they
must have some specific order in which they appear in template argument
list. In this case, an ellipsis may be used to adjust their appearance by
placing it in the beginning or even in the middle.
--
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/0c4a29e2-b327-4957-9120-2fbe623a6ca3%40isocpp.org.
------=_Part_3827_1945114200.1473268406237
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>Thanks for the answers! I'll correct the syntax a=
bit.</div><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">I'm not sure I understand what the point of the `...` part is.=
<br><br>One of the primary problems (to me) with the fully terse template f=
unction syntax is that it declares a template function without telling the =
user that they've done that. So it seems to me that it is enough to sim=
ply use the `template` keyword:<br><br><div style=3D"background-color:rgb(2=
50,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1=
px;word-wrap:break-word"><code><div><span style=3D"color:#008">template</sp=
an><span style=3D"color:#660"><></span><span style=3D"color:#000"><br=
></span><span style=3D"color:#008">void</span><span style=3D"color:#000"> f=
oo</span><span style=3D"color:#660">(</span><span style=3D"color:#008">auto=
</span><span style=3D"color:#000"> x</span><span style=3D"color:#660">);</s=
pan><span style=3D"color:#000"><br></span></div></code></div><br>I just don=
't see a real need to have the `...` there, just to say that the parame=
ter list will also add template arguments. That can be implicit.<br></div><=
/blockquote><div><br></div><div>AFAIK plain <font face=3D"courier new,monos=
pace">template<></font>=C2=A0syntax is already used for explicit func=
tion template specializations. Forgive me if I'm wrong, but such a spec=
ialization is not considered a template but rather a function.</div><div><b=
r></div><div><font face=3D"courier new,monospace">template <..., typenam=
e T></font></div><div><font face=3D"courier new,monospace">void foo2(T x=
, auto y)<br></font></div><div><font face=3D"courier new,monospace">{<br></=
font></div><div><font face=3D"courier new,monospace">}<br></font></div><div=
><font face=3D"courier new,monospace"><br></font></div><div><font face=3D"c=
ourier new,monospace">foo2<int>(42, 42); // OK<br></font></div><div><=
font face=3D"courier new,monospace">foo2<bool, int>(42, false); // OK=
<br></font></div><div><br></div><div>If explicit template parameters are al=
lowed for auto arguments, then they must have some specific order in which =
they appear in template argument list. In this case, an ellipsis may be use=
d to adjust their appearance by placing it in the beginning or even in the =
middle.<font face=3D"courier new,monospace"><br></font></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/0c4a29e2-b327-4957-9120-2fbe623a6ca3%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/0c4a29e2-b327-4957-9120-2fbe623a6ca3=
%40isocpp.org</a>.<br />
------=_Part_3827_1945114200.1473268406237--
------=_Part_3826_358006987.1473268406237--
.
Author: Tom Honermann <tom@honermann.net>
Date: Wed, 7 Sep 2016 13:30:48 -0400
Raw View
This is a multi-part message in MIME format.
--------------5CE8B091D6CEC24C48FB1278
Content-Type: text/plain; charset=UTF-8; format=flowed
On 9/7/2016 1:13 PM, Ivan G. wrote:
> Thanks for the answers! I'll correct the syntax a bit.
>
> I'm not sure I understand what the point of the `...` part is.
>
> One of the primary problems (to me) with the fully terse template
> function syntax is that it declares a template function without
> telling the user that they've done that. So it seems to me that it
> is enough to simply use the `template` keyword:
>
> |
> template<>
> voidfoo(autox);
> |
>
> I just don't see a real need to have the `...` there, just to say
> that the parameter list will also add template arguments. That can
> be implicit.
>
>
> AFAIK plain template<> syntax is already used for explicit function
> template specializations. Forgive me if I'm wrong, but such a
> specialization is not considered a template but rather a function.
>
> template <..., typename T>
> void foo2(T x, auto y)
> {
> }
>
> foo2<int>(42, 42); // OK
> foo2<bool, int>(42, false); // OK
>
> If explicit template parameters are allowed for auto arguments, then
> they must have some specific order in which they appear in template
> argument list. In this case, an ellipsis may be used to adjust their
> appearance by placing it in the beginning or even in the middle.
The Concepts TS specifies the order for invented template parameters.
See N4553 [1] [dcl.fct] 8.3.5 p16-17.
Tom.
[1]: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4553.pdf
--
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/d31e50f3-4d9a-40e0-009a-17b7cad7f497%40honermann.net.
--------------5CE8B091D6CEC24C48FB1278
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
</head>
<body bgcolor=3D"#FFFFFF" text=3D"#000000">
<div class=3D"moz-cite-prefix">On 9/7/2016 1:13 PM, Ivan G. wrote:<br>
</div>
<blockquote
cite=3D"mid:0c4a29e2-b327-4957-9120-2fbe623a6ca3@isocpp.org"
type=3D"cite">
<div dir=3D"ltr">
<div>Thanks for the answers! I'll correct the syntax a bit.</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">I'm not sure I understand what the point of the
`...` part is.<br>
<br>
One of the primary problems (to me) with the fully terse
template function syntax is that it declares a template
function without telling the user that they've done that. So
it seems to me that it is enough to simply use the
`template` keyword:<br>
<br>
<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 style=3D"color:#008">template</span><span
style=3D"color:#660"><></span><span
style=3D"color:#000"><br>
</span><span style=3D"color:#008">void</span><span
style=3D"color:#000"> foo</span><span
style=3D"color:#660">(</span><span style=3D"color:#008"=
>auto</span><span
style=3D"color:#000"> x</span><span style=3D"color:#660=
">);</span><span
style=3D"color:#000"><br>
</span></div>
</code></div>
<br>
I just don't see a real need to have the `...` there, just
to say that the parameter list will also add template
arguments. That can be implicit.<br>
</div>
</blockquote>
<div><br>
</div>
<div>AFAIK plain <font face=3D"courier new,monospace">template<&=
gt;</font>=C2=A0syntax
is already used for explicit function template
specializations. Forgive me if I'm wrong, but such a
specialization is not considered a template but rather a
function.</div>
<div><br>
</div>
<div><font face=3D"courier new,monospace">template <...,
typename T></font></div>
<div><font face=3D"courier new,monospace">void foo2(T x, auto y)<br=
>
</font></div>
<div><font face=3D"courier new,monospace">{<br>
</font></div>
<div><font face=3D"courier new,monospace">}<br>
</font></div>
<div><font face=3D"courier new,monospace"><br>
</font></div>
<div><font face=3D"courier new,monospace">foo2<int>(42, 42);
// OK<br>
</font></div>
<div><font face=3D"courier new,monospace">foo2<bool,
int>(42, false); // OK<br>
</font></div>
<div><br>
</div>
<div>If explicit template parameters are allowed for auto
arguments, then they must have some specific order in which
they appear in template argument list. In this case, an
ellipsis may be used to adjust their appearance by placing it
in the beginning or even in the middle.</div>
</div>
</blockquote>
<br>
The Concepts TS specifies the order for invented template
parameters.=C2=A0 See N4553 [1] [dcl.fct] 8.3.5 p16-17.<br>
<br>
Tom.<br>
<br>
[1]:
<a class=3D"moz-txt-link-freetext" href=3D"http://www.open-std.org/jtc1=
/sc22/wg21/docs/papers/2015/n4553.pdf">http://www.open-std.org/jtc1/sc22/wg=
21/docs/papers/2015/n4553.pdf</a><br>
</body>
</html>
<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/d31e50f3-4d9a-40e0-009a-17b7cad7f497%=
40honermann.net?utm_medium=3Demail&utm_source=3Dfooter">https://groups.goog=
le.com/a/isocpp.org/d/msgid/std-proposals/d31e50f3-4d9a-40e0-009a-17b7cad7f=
497%40honermann.net</a>.<br />
--------------5CE8B091D6CEC24C48FB1278--
.
Author: Tom Honermann <tom@honermann.net>
Date: Wed, 7 Sep 2016 13:57:51 -0400
Raw View
This is a multi-part message in MIME format.
--------------5E546030E0B6642CDCB3ED33
Content-Type: text/plain; charset=UTF-8; format=flowed
On 9/7/2016 12:27 PM, Nicol Bolas wrote:
> On Wednesday, September 7, 2016 at 11:17:38 AM UTC-4, Tom Honermann
> wrote:
>
> On 9/7/2016 10:01 AM, Ivan G. wrote:
>> How about the following function template syntax? An ellipsis in
>> the end of template argument list would allow the function
>> template to use extended functionality as generic lambdas of
>> C++14 and possibly Concepts.
>>
>> template <...>
>> void foo(auto x)
>> {
>> }
>>
>> template <typename T,...>
>> void bar(T x, auto y = 42)
>> {
>> }
>>
>> foo(42); // OK
>> foo<int>(42); // Error?
>> bar(42); // OK
>> bar<int>(42); // OK
>> bar<int, int>(42); // Error?
>>
>> I heard abbreviated templates from Concepts were criticized in
>> related way. This would make the difference between plain
>> functions and function templates more clear. Sorry if this has
>> already been discussed.
>
> I favor the above syntax over the existing design in the Concepts
> TS. I have seen this syntax briefly discussed, but I'm not aware
> of a thorough analysis. I think it would be great if someone
> (hint hint) wrote a paper proposing it.
>
> I think the "Error?" cases should be errors since nothing in the
> declaration creates an obvious connection between the deduced
> parameter type and the corresponding invented template parameter.
> The rules in the Concepts TS are clear on how this would work, but
> the association is fragile.
>
>
> I strongly disagree with that. A terse template function is not a
> special, magical construct. It is a /template function/, and it should
> act like a template function. If it is legal to explicitly specify a
> template function's template parameters, then it should be legal to do
> so if it uses terse syntax, even for the parameters.
>
> We can get a function pointer to a specific instantiation of a
> template function. With what you're saying, it would be impossible to
> do so with a terse template.
>
> There should be no observable difference between:
>
> template<typename T> void func1(T&& t);
>
> and
>
> template<> void func1(auto&& t);
That's a fair point. I retract my assertion that these should be errors.
My concern was that the invented template parameter position for a
parameter declared with a placeholder type may change due to parameter
type changes, additions, or removals in subtle or surprising ways.
Assuming the order of invented template parameters in the Concepts TS,
and that C names a concept:
template <...>
void f(C c, C* pc, auto x, C& rc);
The first, second, and fourth parameters (c, pc, rc) correspond to the
first (invented) template parameter and the third parameter (x)
corresponds to the second. Adding an additional parameter declared with
a placeholder type somewhere in the mix would silently change those
associations. Perhaps this is just a style concern though: if you
expect users to provide explicit template arguments, declare explicit
template parameters as part of the interface.
Tom.
--
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/2c2d5790-e632-3474-6bd7-7efa792b8bcd%40honermann.net.
--------------5E546030E0B6642CDCB3ED33
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
</head>
<body bgcolor=3D"#FFFFFF" text=3D"#000000">
<div class=3D"moz-cite-prefix">On 9/7/2016 12:27 PM, Nicol Bolas
wrote:<br>
</div>
<blockquote
cite=3D"mid:58af8b26-b913-4f2f-a8df-5f69baa733b9@isocpp.org"
type=3D"cite">
<div dir=3D"ltr">On Wednesday, September 7, 2016 at 11:17:38 AM
UTC-4, Tom Honermann wrote:
<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left:
0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
<div bgcolor=3D"#FFFFFF" text=3D"#000000">
<div>On 9/7/2016 10:01 AM, Ivan G. wrote:<br>
</div>
<blockquote type=3D"cite">
<div dir=3D"ltr">
<div>How about the following function template syntax?
An ellipsis in the end of template argument list would
allow the function template to use extended
functionality as generic lambdas of C++14 and possibly
Concepts.<br>
</div>
<div><br>
</div>
<div><font face=3D"courier new,monospace">template
<...></font></div>
<div><font face=3D"courier new,monospace">void foo(auto x)<=
br>
</font></div>
<div><font face=3D"courier new,monospace">{<br>
</font></div>
<div><font face=3D"courier new,monospace">}<br>
</font></div>
<div><font face=3D"courier new,monospace"><br>
</font></div>
<div><font face=3D"courier new,monospace">template
<typename T,...><br>
</font></div>
<div><font face=3D"courier new,monospace">void bar(T x,
auto y =3D 42)<br>
</font></div>
<div><font face=3D"courier new,monospace">{<br>
</font></div>
<div><font face=3D"courier new,monospace">}<br>
</font></div>
<div><font face=3D"courier new,monospace"><br>
</font></div>
<div><font face=3D"courier new,monospace">foo(42); // OK<br=
>
</font></div>
<div><font face=3D"courier new,monospace">foo<int>(42=
);
// Error?<br>
</font></div>
<div><font face=3D"courier new,monospace">bar(42); // OK<br=
>
</font></div>
<div><font face=3D"courier new,monospace">bar<int>(42=
);
// OK<br>
</font></div>
<div><font face=3D"courier new,monospace">bar<int,
int>(42); // Error?<br>
</font></div>
<div><br>
</div>
<div>I heard abbreviated templates from Concepts were
criticized in related way. This would make the
difference between plain functions and function
templates more clear. Sorry if this has already been
discussed.</div>
</div>
</blockquote>
<br>
I favor the above syntax over the existing design in the
Concepts TS.=C2=A0 I have seen this syntax briefly discussed, b=
ut
I'm not aware of a thorough analysis.=C2=A0 I think it would be
great if someone (hint hint) wrote a paper proposing it.<br>
<br>
I think the "Error?" cases should be errors since nothing in
the declaration creates an obvious connection between the
deduced parameter type and the corresponding invented
template parameter.=C2=A0 The rules in the Concepts TS are clea=
r
on how this would work, but the association is fragile.<br>
</div>
</blockquote>
<div><br>
I strongly disagree with that. A terse template function is
not a special, magical construct. It is a <i>template
function</i>, and it should act like a template function. If
it is legal to explicitly specify a template function's
template parameters, then it should be legal to do so if it
uses terse syntax, even for the parameters.<br>
<br>
We can get a function pointer to a specific instantiation of a
template function. With what you're saying, it would be
impossible to do so with a terse template.<br>
<br>
There should be no observable difference between:<br>
<br>
template<typename T> void func1(T&& t);<br>
<br>
and<br>
<br>
template<> void func1(auto&& t);</div>
</div>
</blockquote>
<br>
That's a fair point.=C2=A0 I retract my assertion that these should be
errors.<br>
<br>
My concern was that the invented template parameter position for a
parameter declared with a placeholder type may change due to
parameter type changes, additions, or removals in subtle or
surprising ways.=C2=A0 Assuming the order of invented template paramete=
rs
in the Concepts TS, and that C names a concept:<br>
<br>
template <...><br>
void f(C c, C* pc, auto x, C& rc);<br>
<br>
The first, second, and fourth parameters (c, pc, rc) correspond to
the first (invented) template parameter and the third parameter (x)
corresponds to the second.=C2=A0 Adding an additional parameter declare=
d
with a placeholder type somewhere in the mix would silently change
those associations.=C2=A0 Perhaps this is just a style concern though: =
if
you expect users to provide explicit template arguments, declare
explicit template parameters as part of the interface.<br>
<br>
Tom.<br>
</body>
</html>
<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/2c2d5790-e632-3474-6bd7-7efa792b8bcd%=
40honermann.net?utm_medium=3Demail&utm_source=3Dfooter">https://groups.goog=
le.com/a/isocpp.org/d/msgid/std-proposals/2c2d5790-e632-3474-6bd7-7efa792b8=
bcd%40honermann.net</a>.<br />
--------------5E546030E0B6642CDCB3ED33--
.
Author: Tom Honermann <tom@honermann.net>
Date: Wed, 7 Sep 2016 14:06:11 -0400
Raw View
This is a multi-part message in MIME format.
--------------DD14A987A3FA2FD3FE40F495
Content-Type: text/plain; charset=UTF-8; format=flowed
On 9/7/2016 10:01 AM, Ivan G. wrote:
> How about the following function template syntax? An ellipsis in the
> end of template argument list would allow the function template to use
> extended functionality as generic lambdas of C++14 and possibly Concepts.
>
> template <...>
> void foo(auto x)
> {
> }
>
> template <typename T,...>
> void bar(T x, auto y = 42)
> {
> }
The Concepts TS already allows the second form without the ellipsis:
template <typename T>
void bar(T x, auto y);
The ellipsis is only necessary for the first form to avoid conflicts
with template explicit specialization declarations. I don't see much
harm in allowing it for the second form, but it probably isn't desirable
to require it in order to declare parameters with placeholder types.
Tom.
--
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/312e345d-646a-f3d9-40a6-22680cbd27ca%40honermann.net.
--------------DD14A987A3FA2FD3FE40F495
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<html>
<head>
<meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type=
">
</head>
<body bgcolor=3D"#FFFFFF" text=3D"#000000">
<div class=3D"moz-cite-prefix">On 9/7/2016 10:01 AM, Ivan G. wrote:<br>
</div>
<blockquote
cite=3D"mid:627640bf-62bf-491e-bea9-f76eec0033ec@isocpp.org"
type=3D"cite">
<div dir=3D"ltr">
<div>How about the following function template syntax? An
ellipsis in the end of template argument list would allow the
function template to use extended functionality as generic
lambdas of C++14 and possibly Concepts.<br>
</div>
<div><br>
</div>
<div><font face=3D"courier new,monospace">template <...></fon=
t></div>
<div><font face=3D"courier new,monospace">void foo(auto x)<br>
</font></div>
<div><font face=3D"courier new,monospace">{<br>
</font></div>
<div><font face=3D"courier new,monospace">}<br>
</font></div>
<div><font face=3D"courier new,monospace"><br>
</font></div>
<div><font face=3D"courier new,monospace">template <typename
T,...><br>
</font></div>
<div><font face=3D"courier new,monospace">void bar(T x, auto y =3D
42)<br>
</font></div>
<div><font face=3D"courier new,monospace">{<br>
</font></div>
<div><font face=3D"courier new,monospace">}</font></div>
</div>
</blockquote>
<br>
The Concepts TS already allows the second form without the ellipsis:<br=
>
<br>
template <typename T><br>
void bar(T x, auto y);<br>
<br>
The ellipsis is only necessary for the first form to avoid conflicts
with template explicit specialization declarations.=C2=A0 I don't see
much harm in allowing it for the second form, but it probably isn't
desirable to require it in order to declare parameters with
placeholder types.<br>
<br>
Tom.<br>
</body>
</html>
<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/312e345d-646a-f3d9-40a6-22680cbd27ca%=
40honermann.net?utm_medium=3Demail&utm_source=3Dfooter">https://groups.goog=
le.com/a/isocpp.org/d/msgid/std-proposals/312e345d-646a-f3d9-40a6-22680cbd2=
7ca%40honermann.net</a>.<br />
--------------DD14A987A3FA2FD3FE40F495--
.
Author: "Ivan G." <nekotekina@gmail.com>
Date: Wed, 7 Sep 2016 11:08:08 -0700 (PDT)
Raw View
------=_Part_359_1296811968.1473271688361
Content-Type: multipart/alternative;
boundary="----=_Part_360_1870783310.1473271688361"
------=_Part_360_1870783310.1473271688361
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Does Concepts TS allow mixing invented template parameters and usual=20
template parameters? I couldn't find an example.
Also, is the following code correct C++14? It compiles fine with Visual C++=
=20
and Clang, and lambda's operator() template argument list seems=20
well-specified.
auto foo =3D [](auto x) { return x; };
auto x =3D foo.operator()<int>(42);
Is it still correct in Concepts TS?
=D1=81=D1=80=D0=B5=D0=B4=D0=B0, 7 =D1=81=D0=B5=D0=BD=D1=82=D1=8F=D0=B1=D1=
=80=D1=8F 2016 =D0=B3., 20:30:53 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=
=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Tom Honermann=20
=D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=D0=BB:
>
> The Concepts TS specifies the order for invented template parameters. Se=
e=20
> N4553 [1] [dcl.fct] 8.3.5 p16-17.
>
> Tom.
>
> [1]: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4553.pdf
>
--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/c79a7512-3d53-464c-ad25-8f9f61607791%40isocpp.or=
g.
------=_Part_360_1870783310.1473271688361
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>Does Concepts TS allow mixing invented template param=
eters and usual template parameters? I couldn't find an example.<br></d=
iv><div><br></div><div>Also, is the following code correct C++14? It compil=
es fine with Visual C++ and Clang, and lambda's operator() template arg=
ument list seems well-specified.</div><div>
auto foo =3D [](auto x) { return x; };<br>auto x =3D foo.operator()<int&=
gt;(42);</div><div><br></div><div>Is it still correct in Concepts TS?</div>=
<br>=D1=81=D1=80=D0=B5=D0=B4=D0=B0, 7 =D1=81=D0=B5=D0=BD=D1=82=D1=8F=D0=B1=
=D1=80=D1=8F 2016 =D0=B3., 20:30:53 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=
=BE=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Tom Honermann =D0=BD=D0=B0=D0=BF=D0=
=B8=D1=81=D0=B0=D0=BB:<blockquote class=3D"gmail_quote" style=3D"margin: 0;=
margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
=20
=20
=20
<div bgcolor=3D"#FFFFFF" text=3D"#000000">
The Concepts TS specifies the order for invented template
parameters.=C2=A0 See N4553 [1] [dcl.fct] 8.3.5 p16-17.<br>
<br>
Tom.<br>
<br>
[1]:
<a href=3D"http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n455=
3.pdf" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'h=
ttp://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.open-std.org%2Fjtc1%2Fsc22%2=
Fwg21%2Fdocs%2Fpapers%2F2015%2Fn4553.pdf\x26sa\x3dD\x26sntz\x3d1\x26usg\x3d=
AFQjCNEs8ViTwDZW99e2sFwW568HzTkMvw';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%2F2015%2Fn4553.pdf\x26sa\x3dD\x26sntz\x3d1\x=
26usg\x3dAFQjCNEs8ViTwDZW99e2sFwW568HzTkMvw';return true;">http://www.o=
pen-std.org/jtc1/sc22/wg21/docs/papers/2015/n4553.pdf</a><br>
</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/c79a7512-3d53-464c-ad25-8f9f61607791%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/c79a7512-3d53-464c-ad25-8f9f61607791=
%40isocpp.org</a>.<br />
------=_Part_360_1870783310.1473271688361--
------=_Part_359_1296811968.1473271688361--
.
Author: "Ivan G." <nekotekina@gmail.com>
Date: Wed, 7 Sep 2016 11:11:53 -0700 (PDT)
Raw View
------=_Part_771_810949438.1473271913363
Content-Type: multipart/alternative;
boundary="----=_Part_772_1508051563.1473271913364"
------=_Part_772_1508051563.1473271913364
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Sorry, I didn't see the recent answer.
=D1=81=D1=80=D0=B5=D0=B4=D0=B0, 7 =D1=81=D0=B5=D0=BD=D1=82=D1=8F=D0=B1=D1=
=80=D1=8F 2016 =D0=B3., 21:08:08 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=
=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Ivan G. =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=
=D0=B0=D0=BB:
>
> Does Concepts TS allow mixing invented template parameters and usual=20
> template parameters? I couldn't find an example.
>
>
--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/2c02ec1d-d45c-461c-95aa-8c4f61be2247%40isocpp.or=
g.
------=_Part_772_1508051563.1473271913364
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Sorry, I didn't see the recent answer.<br><br>=D1=81=
=D1=80=D0=B5=D0=B4=D0=B0, 7 =D1=81=D0=B5=D0=BD=D1=82=D1=8F=D0=B1=D1=80=D1=
=8F 2016 =D0=B3., 21:08:08 UTC+3 =D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=
=D0=B0=D1=82=D0=B5=D0=BB=D1=8C Ivan G. =D0=BD=D0=B0=D0=BF=D0=B8=D1=81=D0=B0=
=D0=BB:<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>D=
oes Concepts TS allow mixing invented template parameters and usual templat=
e parameters? I couldn't find an example.<br></div><div><br>
</div><blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8=
ex;border-left:1px #ccc solid;padding-left:1ex">
</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/2c02ec1d-d45c-461c-95aa-8c4f61be2247%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/2c02ec1d-d45c-461c-95aa-8c4f61be2247=
%40isocpp.org</a>.<br />
------=_Part_772_1508051563.1473271913364--
------=_Part_771_810949438.1473271913363--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Wed, 7 Sep 2016 11:19:21 -0700 (PDT)
Raw View
------=_Part_5048_1099620747.1473272361684
Content-Type: multipart/alternative;
boundary="----=_Part_5049_744912597.1473272361684"
------=_Part_5049_744912597.1473272361684
Content-Type: text/plain; charset=UTF-8
On Wednesday, September 7, 2016 at 1:13:26 PM UTC-4, Ivan G. wrote:
>
> Thanks for the answers! I'll correct the syntax a bit.
>
>> I'm not sure I understand what the point of the `...` part is.
>>
>> One of the primary problems (to me) with the fully terse template
>> function syntax is that it declares a template function without telling the
>> user that they've done that. So it seems to me that it is enough to simply
>> use the `template` keyword:
>>
>> template<>
>> void foo(auto x);
>>
>> I just don't see a real need to have the `...` there, just to say that
>> the parameter list will also add template arguments. That can be implicit.
>>
>
> AFAIK plain template<> syntax is already used for explicit function
> template specializations. Forgive me if I'm wrong, but such a
> specialization is not considered a template but rather a function.
>
It is today. But it doesn't have to be tomorrow. It won't change the
meaning of existing code, since specializations will not use any concepts
or `auto` in their parameter lists.
template <..., typename T>
> void foo2(T x, auto y)
> {
> }
>
> foo2<int>(42, 42); // OK
> foo2<bool, int>(42, false); // OK
>
> If explicit template parameters are allowed for auto arguments, then they
> must have some specific order in which they appear in template argument
> list. In this case, an ellipsis may be used to adjust their appearance by
> placing it in the beginning or even in the middle.
>
If there absolutely *must* be some syntax for specifying that, I don't
think `...` is the way to go. I'd much rather have some actual word or
something there.
--
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/3bf60100-298b-477d-b43b-cc7f545fdd31%40isocpp.org.
------=_Part_5049_744912597.1473272361684
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Wednesday, September 7, 2016 at 1:13:26 PM UTC-4, Ivan =
G. 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=
>Thanks for the answers! I'll correct the syntax a bit.</div><div></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">I'm not sure =
I understand what the point of the `...` part is.<br><br>One of the primary=
problems (to me) with the fully terse template function syntax is that it =
declares a template function without telling the user that they've done=
that. So it seems to me that it is enough to simply use the `template` key=
word:<br><br><div style=3D"background-color:rgb(250,250,250);border-color:r=
gb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><=
code><div><span style=3D"color:#008">template</span><span style=3D"color:#6=
60"><></span><span style=3D"color:#000"><br></span><span style=3D"col=
or:#008">void</span><span style=3D"color:#000"> foo</span><span style=3D"co=
lor:#660">(</span><span style=3D"color:#008">auto</span><span style=3D"colo=
r:#000"> x</span><span style=3D"color:#660">);</span><span style=3D"color:#=
000"><br></span></div></code></div><br>I just don't see a real need to =
have the `...` there, just to say that the parameter list will also add tem=
plate arguments. That can be implicit.<br></div></blockquote><div><br></div=
><div>AFAIK plain <font face=3D"courier new,monospace">template<></fo=
nt>=C2=A0syntax is already used for explicit function template specializati=
ons. Forgive me if I'm wrong, but such a specialization is not consider=
ed a template but rather a function.</div></div></blockquote><div><br>It is=
today. But it doesn't have to be tomorrow. It won't change the mea=
ning of existing code, since specializations will not use any concepts or `=
auto` in their parameter lists.<br><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></div><div><font face=3D"courier new,m=
onospace">template <..., typename T></font></div><div><font face=3D"c=
ourier new,monospace">void foo2(T x, auto y)<br></font></div><div><font fac=
e=3D"courier new,monospace">{<br></font></div><div><font face=3D"courier ne=
w,monospace">}<br></font></div><div><font face=3D"courier new,monospace"><b=
r></font></div><div><font face=3D"courier new,monospace">foo2<int>(42=
, 42); // OK<br></font></div><div><font face=3D"courier new,monospace">foo2=
<bool, int>(42, false); // OK<br></font></div><div><br></div><div>If =
explicit template parameters are allowed for auto arguments, then they must=
have some specific order in which they appear in template argument list. I=
n this case, an ellipsis may be used to adjust their appearance by placing =
it in the beginning or even in the middle.<font face=3D"courier new,monospa=
ce"><br></font></div></div></blockquote><div><br>If there absolutely *must*=
be some syntax for specifying that, I don't think `...` is the way to =
go. I'd much rather have some actual word or something there.<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/3bf60100-298b-477d-b43b-cc7f545fdd31%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/3bf60100-298b-477d-b43b-cc7f545fdd31=
%40isocpp.org</a>.<br />
------=_Part_5049_744912597.1473272361684--
------=_Part_5048_1099620747.1473272361684--
.
Author: Tom Honermann <tom@honermann.net>
Date: Wed, 7 Sep 2016 14:26:58 -0400
Raw View
On 9/7/2016 2:08 PM, Ivan G. wrote:
> Also, is the following code correct C++14? It compiles fine with=20
> Visual C++ and Clang, and lambda's operator() template argument list=20
> seems well-specified.
> auto foo =3D [](auto x) { return x; };
> auto x =3D foo.operator()<int>(42);
I believe so. [expr.prim.lambda] 5.1.2p5 seems pretty clear:
"For a generic lambda, the closure type has a public inline function call
operator member template (14.5.2) whose template-parameter-list consists=20
of one invented type template-
parameter for each occurrence of auto in the lambda=E2=80=99s=20
parameter-declaration-clause, in order of appearance."
>
> Is it still correct in Concepts TS?
I'm not aware of anything in the Concepts TS that would impact this=20
(other than that concept placeholders may be used in the parameter=20
declaration as well).
Tom.
--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/5f3b052e-d3ef-b18d-268f-2e50d62993b5%40honermann=
..net.
.