Topic: ADL and explicit template arguments


Author: rhalbersma@gmail.com
Date: Thu, 21 Nov 2013 01:45:41 -0800 (PST)
Raw View
------=_Part_5174_1700508.1385027141209
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable



This is a small proposal to extend the .template, ->template and ::template=
 syntax to non-member function templates with explicit template arguments. =
Consider the following example from *[temp.arg.explicit]/8*

 // EXAMPLE

namespace A {
    struct B { };
    template<int X> void f(B);
}
namespace C {
    template<class T> void f(T t);
}
void g(A::B b) {
f<3>(b);            // ill-formed: not a function call
A::f<3>(b);         // well-formed
C::f<3>(b);         // ill-formed; argument dependent lookup
                    // applies only to unquali=EF=AC=81ed names

using C::f;           =20
f<3>(b);            // well-formed because C::f is visible; then
                    // A::f is found by argument dependent lookup=20
}

My proposal is to add the template keyword in front of f<3>(b) to make such=
 a function call well-formed and to enable ADL without having to pull the t=
emplate name into scope.

// PROPOSAL
void g(A::B b) {
template f<3>(b);   // well-formed: template keyword followed by template-i=
d
                    // A::f is found by argument dependent lookup
}

This overloading of the template keyword is consistent with *[temp.names]/5=
*: "A name pre=EF=AC=81xed by the keyword template shall be a template-id o=
r the name shall refer to a class template."

Please destroy!


--=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_5174_1700508.1385027141209
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><pre style=3D"margin-bottom: 10px; padding: 5px; backgroun=
d-color: rgb(238, 238, 238); overflow: auto; width: auto; max-height: 600px=
; word-wrap: normal;"><font color=3D"#000000"><span style=3D"font-size: 14p=
x; line-height: 18px;"><font face=3D"arial, sans-serif">This is a small pro=
posal to extend the</font><font face=3D"courier new, monospace"> .template<=
/font><font face=3D"arial, sans-serif">, </font><font face=3D"courier new, =
monospace">-&gt;template</font><font face=3D"arial, sans-serif"> and </font=
><font face=3D"courier new, monospace">::template</font><font face=3D"arial=
, sans-serif"> syntax to non-member function templates with explicit templa=
te arguments. Consider the following example from&nbsp;</font></span></font=
><b style=3D"color: rgb(0, 0, 0); font-family: arial, sans-serif; backgroun=
d-color: white; font-size: 14px; line-height: 18px;">[temp.arg.explicit]/8<=
/b></pre><font color=3D"#000000" face=3D"monospace"><span style=3D"font-siz=
e: 14px; line-height: 18px; white-space: pre;">&nbsp;</span></font><span st=
yle=3D"font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation =
Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monos=
pace, serif; background-color: rgb(238, 238, 238); color: rgb(0, 0, 0); fon=
t-size: 14px; line-height: 18px;">// EXAMPLE</span><div><pre style=3D"margi=
n-bottom: 10px; padding: 5px; font-size: 14px; background-color: rgb(238, 2=
38, 238); font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberati=
on Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', mo=
nospace, serif; overflow: auto; width: auto; max-height: 600px; word-wrap: =
normal; color: rgb(0, 0, 0); line-height: 18px;"><code style=3D"font-family=
: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu San=
s Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;">name=
space A {
    struct B { };
    template&lt;int X&gt; void f(B);
}
namespace C {
    template&lt;class T&gt; void f(T t);
}
void g(A::B b) {
f&lt;3&gt;(b);            // ill-formed: not a function call
A::f&lt;3&gt;(b);         // well-formed
C::f&lt;3&gt;(b);         // ill-formed; argument dependent lookup
                    // applies only to unquali=EF=AC=81ed names

using C::f;           =20
f&lt;3&gt;(b);            // well-formed because C::f is visible; then
                    // A::f is found by argument dependent lookup=20
}</code></pre><pre style=3D"margin-bottom: 10px; padding: 5px; font-size: 1=
4px; background-color: rgb(238, 238, 238); overflow: auto; width: auto; max=
-height: 600px; word-wrap: normal; color: rgb(0, 0, 0); line-height: 18px;"=
><code><span style=3D"font-family: Arial, Helvetica, sans-serif; font-size:=
 13px;">My proposal is to add the </span><span style=3D"font-size: 13px;"><=
font face=3D"courier new, monospace">template</font></span><span style=3D"f=
ont-family: Arial, Helvetica, sans-serif; font-size: 13px;"> keyword in fro=
nt of</span><span style=3D"font-size: 13px;"><font face=3D"courier new, mon=
ospace"> f&lt;3&gt;(b)</font></span><span style=3D"font-family: Arial, Helv=
etica, sans-serif; font-size: 13px;"> to make such a function call well-for=
med and to enable ADL without having to pull the template name into scope.<=
/span></code></pre><pre style=3D"margin-bottom: 10px; padding: 5px; font-si=
ze: 14px; background-color: rgb(238, 238, 238); font-family: Consolas, Menl=
o, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstr=
eam Vera Sans Mono', 'Courier New', monospace, serif; overflow: auto; width=
: auto; max-height: 600px; word-wrap: normal; color: rgb(0, 0, 0); line-hei=
ght: 18px;"><code style=3D"font-family: Consolas, Menlo, Monaco, 'Lucida Co=
nsole', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', =
'Courier New', monospace, serif;">// PROPOSAL
void g(A::B b) {
template f&lt;3&gt;(b);   // well-formed: template keyword followed by temp=
late-id
                    // A::f is found by argument dependent lookup
}</code></pre><pre style=3D"margin-bottom: 10px; padding: 5px; background-c=
olor: rgb(238, 238, 238); overflow: auto; width: auto; max-height: 600px; w=
ord-wrap: normal;"><code style=3D"color: rgb(0, 0, 0); font-size: 14px; lin=
e-height: 18px;"><font face=3D"arial, sans-serif">This overloading of the <=
/font><font face=3D"courier new, monospace">template</font><font face=3D"ar=
ial, sans-serif"> keyword is consistent with <b>[temp.names]/5</b>: "</font=
></code><span style=3D"background-color: white; font-size: 14px; line-heigh=
t: 18px;"><font color=3D"#000000" face=3D"arial, sans-serif">A name pre=EF=
=AC=81xed by the keyword template shall be a template-id or the name shall =
refer to a class template."</font></span></pre><pre style=3D"margin-bottom:=
 10px; padding: 5px; background-color: rgb(238, 238, 238); overflow: auto; =
width: auto; max-height: 600px; word-wrap: normal;"><font color=3D"#000000"=
 face=3D"arial, sans-serif"><span style=3D"font-size: 14px; line-height: 18=
px;">Please destroy!</span></font></pre><pre style=3D"margin-bottom: 10px; =
padding: 5px; font-size: 14px; background-color: rgb(238, 238, 238); font-f=
amily: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaV=
u Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; =
overflow: auto; width: auto; max-height: 600px; word-wrap: normal; color: r=
gb(0, 0, 0); line-height: 18px;"><code style=3D"font-family: Consolas, Menl=
o, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstr=
eam Vera Sans Mono', 'Courier New', monospace, serif;"><br></code></pre></d=
iv></div>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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_5174_1700508.1385027141209--

.


Author: "Billy O'Neal" <billy.oneal@gmail.com>
Date: Thu, 21 Nov 2013 10:03:50 -0800
Raw View
--089e0158ab20a9797004ebb3ba2a
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

This should probably be an additional example -- the ill formed example
should be there too.

Billy O'Neal
https://github.com/BillyONeal/ <https://bitbucket.org/BillyONeal/>
http://stackoverflow.com/users/82320/billy-oneal
Malware Response Instructor - BleepingComputer.com


On Thu, Nov 21, 2013 at 1:45 AM, <rhalbersma@gmail.com> wrote:

> This is a small proposal to extend the .template, ->template and ::templa=
te syntax to non-member function templates with explicit template arguments=
.. Consider the following example from *[temp.arg.explicit]/8*
>
>  // EXAMPLE
>
> namespace A {
>     struct B { };
>     template<int X> void f(B);
> }
> namespace C {
>     template<class T> void f(T t);
> }
> void g(A::B b) {
> f<3>(b);            // ill-formed: not a function call
> A::f<3>(b);         // well-formed
> C::f<3>(b);         // ill-formed; argument dependent lookup
>                     // applies only to unquali=EF=AC=81ed names
>
> using C::f;
> f<3>(b);            // well-formed because C::f is visible; then
>                     // A::f is found by argument dependent lookup
> }
>
> My proposal is to add the template keyword in front of f<3>(b) to make su=
ch a function call well-formed and to enable ADL without having to pull the=
 template name into scope.
>
> // PROPOSAL
> void g(A::B b) {
> template f<3>(b);   // well-formed: template keyword followed by template=
-id
>                     // A::f is found by argument dependent lookup
> }
>
> This overloading of the template keyword is consistent with *[temp.names]=
/5*: "A name pre=EF=AC=81xed by the keyword template shall be a template-id=
 or the name shall refer to a class template."
>
> Please destroy!
>
>
>  --
>
> ---
> 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/.
>

--=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/.

--089e0158ab20a9797004ebb3ba2a
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">This should probably be an additional example -- the ill f=
ormed example should be there too.</div><div class=3D"gmail_extra"><br clea=
r=3D"all"><div><div dir=3D"ltr"><div>Billy O&#39;Neal</div><div><a href=3D"=
https://bitbucket.org/BillyONeal/" target=3D"_blank">https://github.com/Bil=
lyONeal/</a></div>

<div><a href=3D"http://stackoverflow.com/users/82320/billy-oneal" target=3D=
"_blank">http://stackoverflow.com/users/82320/billy-oneal</a></div><div>Mal=
ware Response Instructor - BleepingComputer.com</div></div></div>
<br><br><div class=3D"gmail_quote">On Thu, Nov 21, 2013 at 1:45 AM,  <span =
dir=3D"ltr">&lt;<a href=3D"mailto:rhalbersma@gmail.com" target=3D"_blank">r=
halbersma@gmail.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail_quo=
te" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"=
>

<div dir=3D"ltr"><pre style=3D"padding:5px;width:auto;overflow:auto;margin-=
bottom:10px;max-height:600px;background-color:rgb(238,238,238)"><font color=
=3D"#000000"><span style=3D"line-height:18px;font-size:14px"><font face=3D"=
arial, sans-serif">This is a small proposal to extend the</font><font face=
=3D"courier new, monospace"> .template</font><font face=3D"arial, sans-seri=
f">, </font><font face=3D"courier new, monospace">-&gt;template</font><font=
 face=3D"arial, sans-serif"> and </font><font face=3D"courier new, monospac=
e">::template</font><font face=3D"arial, sans-serif"> syntax to non-member =
function templates with explicit template arguments. Consider the following=
 example from=C2=A0</font></span></font><b style=3D"line-height:18px;font-f=
amily:arial,sans-serif;font-size:14px;background-color:white">[temp.arg.exp=
licit]/8</b></pre>

<font color=3D"#000000" face=3D"monospace"><span style=3D"line-height:18px;=
font-size:14px;white-space:pre-wrap">=C2=A0</span></font><span style=3D"lin=
e-height:18px;font-family:Consolas,Menlo,Monaco,&quot;Lucida Console&quot;,=
&quot;Liberation Mono&quot;,&quot;DejaVu Sans Mono&quot;,&quot;Bitstream Ve=
ra Sans Mono&quot;,&quot;Courier New&quot;,monospace,serif;font-size:14px;b=
ackground-color:rgb(238,238,238)">// EXAMPLE</span><div>

<pre style=3D"padding:5px;width:auto;line-height:18px;overflow:auto;font-fa=
mily:Consolas,Menlo,Monaco,&quot;Lucida Console&quot;,&quot;Liberation Mono=
&quot;,&quot;DejaVu Sans Mono&quot;,&quot;Bitstream Vera Sans Mono&quot;,&q=
uot;Courier New&quot;,monospace,serif;font-size:14px;margin-bottom:10px;max=
-height:600px;background-color:rgb(238,238,238)">

<code style=3D"font-family:Consolas,Menlo,Monaco,&quot;Lucida Console&quot;=
,&quot;Liberation Mono&quot;,&quot;DejaVu Sans Mono&quot;,&quot;Bitstream V=
era Sans Mono&quot;,&quot;Courier New&quot;,monospace,serif">namespace A {
    struct B { };
    template&lt;int X&gt; void f(B);
}
namespace C {
    template&lt;class T&gt; void f(T t);
}
void g(A::B b) {
f&lt;3&gt;(b);            // ill-formed: not a function call
A::f&lt;3&gt;(b);         // well-formed
C::f&lt;3&gt;(b);         // ill-formed; argument dependent lookup
                    // applies only to unquali=EF=AC=81ed names

using C::f;           =20
f&lt;3&gt;(b);            // well-formed because C::f is visible; then
                    // A::f is found by argument dependent lookup=20
}</code></pre><pre style=3D"padding:5px;width:auto;line-height:18px;overflo=
w:auto;font-size:14px;margin-bottom:10px;max-height:600px;background-color:=
rgb(238,238,238)"><code><span style=3D"font-family:Arial,Helvetica,sans-ser=
if;font-size:13px">My proposal is to add the </span><span style=3D"font-siz=
e:13px"><font face=3D"courier new, monospace">template</font></span><span s=
tyle=3D"font-family:Arial,Helvetica,sans-serif;font-size:13px"> keyword in =
front of</span><span style=3D"font-size:13px"><font face=3D"courier new, mo=
nospace"> f&lt;3&gt;(b)</font></span><span style=3D"font-family:Arial,Helve=
tica,sans-serif;font-size:13px"> to make such a function call well-formed a=
nd to enable ADL without having to pull the template name into scope.</span=
></code></pre>

<pre style=3D"padding:5px;width:auto;line-height:18px;overflow:auto;font-fa=
mily:Consolas,Menlo,Monaco,&quot;Lucida Console&quot;,&quot;Liberation Mono=
&quot;,&quot;DejaVu Sans Mono&quot;,&quot;Bitstream Vera Sans Mono&quot;,&q=
uot;Courier New&quot;,monospace,serif;font-size:14px;margin-bottom:10px;max=
-height:600px;background-color:rgb(238,238,238)">

<code style=3D"font-family:Consolas,Menlo,Monaco,&quot;Lucida Console&quot;=
,&quot;Liberation Mono&quot;,&quot;DejaVu Sans Mono&quot;,&quot;Bitstream V=
era Sans Mono&quot;,&quot;Courier New&quot;,monospace,serif">// PROPOSAL
void g(A::B b) {
template f&lt;3&gt;(b);   // well-formed: template keyword followed by temp=
late-id
                    // A::f is found by argument dependent lookup
}</code></pre><pre style=3D"padding:5px;width:auto;overflow:auto;margin-bot=
tom:10px;max-height:600px;background-color:rgb(238,238,238)"><code style=3D=
"line-height:18px;font-size:14px"><font face=3D"arial, sans-serif">This ove=
rloading of the </font><font face=3D"courier new, monospace">template</font=
><font face=3D"arial, sans-serif"> keyword is consistent with <b>[temp.name=
s]/5</b>: &quot;</font></code><span style=3D"line-height:18px;font-size:14p=
x;background-color:white"><font color=3D"#000000" face=3D"arial, sans-serif=
">A name pre=EF=AC=81xed by the keyword template shall be a template-id or =
the name shall refer to a class template.&quot;</font></span></pre>

<pre style=3D"padding:5px;width:auto;overflow:auto;margin-bottom:10px;max-h=
eight:600px;background-color:rgb(238,238,238)"><font color=3D"#000000" face=
=3D"arial, sans-serif"><span style=3D"line-height:18px;font-size:14px">Plea=
se destroy!</span></font></pre>

<span class=3D"HOEnZb"><font color=3D"#888888"><pre style=3D"padding:5px;wi=
dth:auto;line-height:18px;overflow:auto;font-family:Consolas,Menlo,Monaco,&=
quot;Lucida Console&quot;,&quot;Liberation Mono&quot;,&quot;DejaVu Sans Mon=
o&quot;,&quot;Bitstream Vera Sans Mono&quot;,&quot;Courier New&quot;,monosp=
ace,serif;font-size:14px;margin-bottom:10px;max-height:600px;background-col=
or:rgb(238,238,238)">

<code style=3D"font-family:Consolas,Menlo,Monaco,&quot;Lucida Console&quot;=
,&quot;Liberation Mono&quot;,&quot;DejaVu Sans Mono&quot;,&quot;Bitstream V=
era Sans Mono&quot;,&quot;Courier New&quot;,monospace,serif"><br></code></p=
re>

</font></span></div></div><span class=3D"HOEnZb"><font color=3D"#888888">

<p></p>

-- <br>
=C2=A0<br>
--- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org" target=3D=
"_blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</font></span></blockquote></div><br></div>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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 />

--089e0158ab20a9797004ebb3ba2a--

.


Author: rhalbersma@gmail.com
Date: Fri, 22 Nov 2013 00:17:54 -0800 (PST)
Raw View
------=_Part_489_24454823.1385108274544
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Thursday, November 21, 2013 7:03:50 PM UTC+1, Billy O'Neal wrote:
>
> This should probably be an additional example -- the ill formed example=
=20
> should be there too.
>

Sorry if it wasn't clear.
It was indeed implied that the new syntax was part of the existing example=
=20
from the Standard.=20
To be sure: under my proposal, the modified example from  *[temp.arg.explic=
it]/8=20
*would then read (modifications in blue)

namespace A {
    struct B { };
    template<int X> void f(B);
}
namespace C {
    template<class T> void f(T t);
}
void g(A::B b) {
f<3>(b);            // ill-formed: not a function call
A::f<3>(b);         // well-formed
C::f<3>(b);         // ill-formed; argument dependent lookup
                    // applies only to unquali=EF=AC=81ed names
template f<3>(b);   // well-formed: template keyword followed by template-i=
d
                    // A::f is found by argument dependent lookup
using C::f;           =20
f<3>(b);            // well-formed because C::f is visible; then
                    // A::f is found by argument dependent lookup=20
}

Any feedback on the usability / desirability for this proposal would be=20
appreciated!

=20

--=20

---=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

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

<div dir=3D"ltr">On Thursday, November 21, 2013 7:03:50 PM UTC+1, Billy O'N=
eal 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">Thi=
s should probably be an additional example -- the ill formed example should=
 be there too.</div></blockquote><div><br></div><div><font face=3D"arial, s=
ans-serif" size=3D"2">Sorry if it wasn't clear.</font></div><div><font face=
=3D"arial, sans-serif" size=3D"2">It was indeed implied that the new syntax=
 was part of the existing example from the Standard.&nbsp;</font></div><div=
><font face=3D"arial, sans-serif" size=3D"2">To be sure: under my proposal,=
 the modified example from &nbsp;<b style=3D"color: rgb(0, 0, 0); line-heig=
ht: 18px;">[temp.arg.explicit]/8 </b><span style=3D"color: rgb(0, 0, 0); li=
ne-height: 18px;">would then read (</span><span style=3D"line-height: 18px;=
"><font color=3D"#0000ff">modifications in blue</font></span><span style=3D=
"color: rgb(0, 0, 0); line-height: 18px;">)</span></font></div><div><font f=
ace=3D"arial, sans-serif" size=3D"2"><span style=3D"color: rgb(0, 0, 0); li=
ne-height: 18px;"><br></span></font></div><div><pre style=3D"margin-bottom:=
 10px; padding: 5px; font-size: 14px; background-color: rgb(238, 238, 238);=
 font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono',=
 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, =
serif; overflow: auto; width: auto; max-height: 600px; word-wrap: normal; l=
ine-height: 18px;"><pre style=3D"margin-bottom: 10px; padding: 5px; font-fa=
mily: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu=
 Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; o=
verflow: auto; width: auto; max-height: 600px; word-wrap: normal;"><code st=
yle=3D"font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation =
Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monos=
pace, serif;"><font color=3D"#000000">namespace A {
    struct B { };
    template&lt;int X&gt; void f(B);
}
namespace C {
    template&lt;class T&gt; void f(T t);
}
void g(A::B b) {
f&lt;3&gt;(b);            // ill-formed: not a function call
A::f&lt;3&gt;(b);         // well-formed
C::f&lt;3&gt;(b);         // ill-formed; argument dependent lookup
                    // applies only to unquali=EF=AC=81ed names

</font><font color=3D"#0000ff">template f&lt;3&gt;(b);   // well-formed: te=
mplate keyword followed by template-id
                    // A::f is found by argument dependent lookup
</font><font color=3D"#000000">
using C::f;           =20
f&lt;3&gt;(b);            // well-formed because C::f is visible; then
                    // A::f is found by argument dependent lookup=20
}</font></code></pre></pre></div><div><code><font size=3D"2" face=3D"arial,=
 sans-serif">Any feedback on the usability / desirability for this proposal=
 would be appreciated!</font></code></div><div><br></div><div>&nbsp;</div><=
/div>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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_489_24454823.1385108274544--

.


Author: Andrew Tomazos <andrewtomazos@gmail.com>
Date: Fri, 22 Nov 2013 14:53:44 +0100
Raw View
--001a113362acbb47c904ebc45718
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

I think your proposal is actually to move the optional template_opt
prefixes from all the places it is now in the grammar to inside
simple-template-id:

OLD:

   simple-template-id:
       template-name < template-argument-list_opt >

NEW:

   simple-template-id:
       template_opt template-name < template-argument-list_opt >

On the surface this makes sense, but it's pretty difficult to follow all
the ramifications of this without some study.  It isn't clear whether the
grammar evolved into it's current state or whether the above was explicitly
considered and discarded at some point.



On Thu, Nov 21, 2013 at 10:45 AM, <rhalbersma@gmail.com> wrote:

> This is a small proposal to extend the .template, ->template and ::templa=
te syntax to non-member function templates with explicit template arguments=
.. Consider the following example from *[temp.arg.explicit]/8*
>
>  // EXAMPLE
>
> namespace A {
>     struct B { };
>     template<int X> void f(B);
> }
> namespace C {
>     template<class T> void f(T t);
> }
> void g(A::B b) {
> f<3>(b);            // ill-formed: not a function call
> A::f<3>(b);         // well-formed
> C::f<3>(b);         // ill-formed; argument dependent lookup
>                     // applies only to unquali=EF=AC=81ed names
>
> using C::f;
> f<3>(b);            // well-formed because C::f is visible; then
>                     // A::f is found by argument dependent lookup
> }
>
> My proposal is to add the template keyword in front of f<3>(b) to make su=
ch a function call well-formed and to enable ADL without having to pull the=
 template name into scope.
>
> // PROPOSAL
> void g(A::B b) {
> template f<3>(b);   // well-formed: template keyword followed by template=
-id
>                     // A::f is found by argument dependent lookup
> }
>
> This overloading of the template keyword is consistent with *[temp.names]=
/5*: "A name pre=EF=AC=81xed by the keyword template shall be a template-id=
 or the name shall refer to a class template."
>
> Please destroy!
>
>
>  --
>
> ---
> 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/.
>

--=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/.

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

<div dir=3D"ltr">I think your proposal is actually to move the optional tem=
plate_opt prefixes from all the places it is now in the grammar to inside s=
imple-template-id:<div><br></div><div>OLD:</div><div><br></div><div>=C2=A0 =
=C2=A0simple-template-id:</div>
<div>=C2=A0 =C2=A0 =C2=A0 =C2=A0template-name &lt; template-argument-list_o=
pt &gt;</div><div><br></div><div>NEW:</div><div><div><br class=3D"">=C2=A0 =
=C2=A0simple-template-id:</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0template_opt=
 template-name &lt; template-argument-list_opt &gt;</div>
</div><div><br></div><div>On the surface this makes sense, but it&#39;s pre=
tty difficult to follow all the ramifications of this without some study. =
=C2=A0It isn&#39;t clear whether the grammar evolved into it&#39;s current =
state or whether the above was explicitly considered and discarded at some =
point.</div>
<div><br></div></div><div class=3D"gmail_extra"><br><br><div class=3D"gmail=
_quote">On Thu, Nov 21, 2013 at 10:45 AM,  <span dir=3D"ltr">&lt;<a href=3D=
"mailto:rhalbersma@gmail.com" target=3D"_blank">rhalbersma@gmail.com</a>&gt=
;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex"><div dir=3D"ltr"><pre style=3D"margin-bottom=
:10px;padding:5px;background-color:rgb(238,238,238);overflow:auto;width:aut=
o;max-height:600px;word-wrap:normal">
<font color=3D"#000000"><span style=3D"font-size:14px;line-height:18px"><fo=
nt face=3D"arial, sans-serif">This is a small proposal to extend the</font>=
<font face=3D"courier new, monospace"> .template</font><font face=3D"arial,=
 sans-serif">, </font><font face=3D"courier new, monospace">-&gt;template</=
font><font face=3D"arial, sans-serif"> and </font><font face=3D"courier new=
, monospace">::template</font><font face=3D"arial, sans-serif"> syntax to n=
on-member function templates with explicit template arguments. Consider the=
 following example from=C2=A0</font></span></font><b style=3D"line-height:1=
8px;font-size:14px;background-color:white;font-family:arial,sans-serif">[te=
mp.arg.explicit]/8</b></pre>
<font color=3D"#000000" face=3D"monospace"><span style=3D"font-size:14px;li=
ne-height:18px;white-space:pre-wrap">=C2=A0</span></font><span style=3D"lin=
e-height:18px;font-size:14px;background-color:rgb(238,238,238);font-family:=
Consolas,Menlo,Monaco,&#39;Lucida Console&#39;,&#39;Liberation Mono&#39;,&#=
39;DejaVu Sans Mono&#39;,&#39;Bitstream Vera Sans Mono&#39;,&#39;Courier Ne=
w&#39;,monospace,serif">// EXAMPLE</span><div>
<pre style=3D"line-height:18px;max-height:600px;width:auto;overflow:auto;fo=
nt-size:14px;background-color:rgb(238,238,238);margin-bottom:10px;font-fami=
ly:Consolas,Menlo,Monaco,&#39;Lucida Console&#39;,&#39;Liberation Mono&#39;=
,&#39;DejaVu Sans Mono&#39;,&#39;Bitstream Vera Sans Mono&#39;,&#39;Courier=
 New&#39;,monospace,serif;word-wrap:normal;padding:5px">
<code style=3D"font-family:Consolas,Menlo,Monaco,&#39;Lucida Console&#39;,&=
#39;Liberation Mono&#39;,&#39;DejaVu Sans Mono&#39;,&#39;Bitstream Vera San=
s Mono&#39;,&#39;Courier New&#39;,monospace,serif">namespace A {
    struct B { };
    template&lt;int X&gt; void f(B);
}
namespace C {
    template&lt;class T&gt; void f(T t);
}
void g(A::B b) {
f&lt;3&gt;(b);            // ill-formed: not a function call
A::f&lt;3&gt;(b);         // well-formed
C::f&lt;3&gt;(b);         // ill-formed; argument dependent lookup
                    // applies only to unquali=EF=AC=81ed names

using C::f;           =20
f&lt;3&gt;(b);            // well-formed because C::f is visible; then
                    // A::f is found by argument dependent lookup=20
}</code></pre><pre style=3D"line-height:18px;max-height:600px;width:auto;ov=
erflow:auto;font-size:14px;background-color:rgb(238,238,238);margin-bottom:=
10px;word-wrap:normal;padding:5px"><code><span style=3D"font-family:Arial,H=
elvetica,sans-serif;font-size:13px">My proposal is to add the </span><span =
style=3D"font-size:13px"><font face=3D"courier new, monospace">template</fo=
nt></span><span style=3D"font-family:Arial,Helvetica,sans-serif;font-size:1=
3px"> keyword in front of</span><span style=3D"font-size:13px"><font face=
=3D"courier new, monospace"> f&lt;3&gt;(b)</font></span><span style=3D"font=
-family:Arial,Helvetica,sans-serif;font-size:13px"> to make such a function=
 call well-formed and to enable ADL without having to pull the template nam=
e into scope.</span></code></pre>
<pre style=3D"line-height:18px;max-height:600px;width:auto;overflow:auto;fo=
nt-size:14px;background-color:rgb(238,238,238);margin-bottom:10px;font-fami=
ly:Consolas,Menlo,Monaco,&#39;Lucida Console&#39;,&#39;Liberation Mono&#39;=
,&#39;DejaVu Sans Mono&#39;,&#39;Bitstream Vera Sans Mono&#39;,&#39;Courier=
 New&#39;,monospace,serif;word-wrap:normal;padding:5px">
<code style=3D"font-family:Consolas,Menlo,Monaco,&#39;Lucida Console&#39;,&=
#39;Liberation Mono&#39;,&#39;DejaVu Sans Mono&#39;,&#39;Bitstream Vera San=
s Mono&#39;,&#39;Courier New&#39;,monospace,serif">// PROPOSAL
void g(A::B b) {
template f&lt;3&gt;(b);   // well-formed: template keyword followed by temp=
late-id
                    // A::f is found by argument dependent lookup
}</code></pre><pre style=3D"margin-bottom:10px;padding:5px;background-color=
:rgb(238,238,238);overflow:auto;width:auto;max-height:600px;word-wrap:norma=
l"><code style=3D"line-height:18px;font-size:14px"><font face=3D"arial, san=
s-serif">This overloading of the </font><font face=3D"courier new, monospac=
e">template</font><font face=3D"arial, sans-serif"> keyword is consistent w=
ith <b>[temp.names]/5</b>: &quot;</font></code><span style=3D"background-co=
lor:white;font-size:14px;line-height:18px"><font color=3D"#000000" face=3D"=
arial, sans-serif">A name pre=EF=AC=81xed by the keyword template shall be =
a template-id or the name shall refer to a class template.&quot;</font></sp=
an></pre>
<pre style=3D"margin-bottom:10px;padding:5px;background-color:rgb(238,238,2=
38);overflow:auto;width:auto;max-height:600px;word-wrap:normal"><font color=
=3D"#000000" face=3D"arial, sans-serif"><span style=3D"font-size:14px;line-=
height:18px">Please destroy!</span></font></pre>
<span class=3D"HOEnZb"><font color=3D"#888888"><pre style=3D"line-height:18=
px;max-height:600px;width:auto;overflow:auto;font-size:14px;background-colo=
r:rgb(238,238,238);margin-bottom:10px;font-family:Consolas,Menlo,Monaco,&#3=
9;Lucida Console&#39;,&#39;Liberation Mono&#39;,&#39;DejaVu Sans Mono&#39;,=
&#39;Bitstream Vera Sans Mono&#39;,&#39;Courier New&#39;,monospace,serif;wo=
rd-wrap:normal;padding:5px">
<code style=3D"font-family:Consolas,Menlo,Monaco,&#39;Lucida Console&#39;,&=
#39;Liberation Mono&#39;,&#39;DejaVu Sans Mono&#39;,&#39;Bitstream Vera San=
s Mono&#39;,&#39;Courier New&#39;,monospace,serif"><br></code></pre></font>=
</span></div>
</div><span class=3D"HOEnZb"><font color=3D"#888888">

<p></p>

-- <br>
=C2=A0<br>
--- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals%2Bunsubscribe@isocpp.org" target=3D=
"_blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</font></span></blockquote></div><br></div>

<p></p>

-- <br />
&nbsp;<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.<br />
To post to this group, send email to std-proposals@isocpp.org.<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 />

--001a113362acbb47c904ebc45718--

.