Topic: Local class template methods
Author: enelar@develop-project.ru
Date: Fri, 14 Mar 2014 11:18:02 -0700 (PDT)
Raw View
------=_Part_619_17419934.1394821082329
Content-Type: text/plain; charset=UTF-8
Since new generic lambda it really strange not having analog for local
classes.
void f()
{
auto F = []( auto p ) // OK
{
}
struct C
{
int lalalalal; // helper fields
template<typename T> // C2892
void TF( T p )
{
}
void F( auto p ) // C3533
{
}
}
int a;
string b;
F(a); // ok
F(b); // ok
C obj;
obj.TF(a); //_-
obj.TF(b); //_-
obj.F(a); //_-
obj.F(b); //_-
}
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_619_17419934.1394821082329
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Since new generic lambda it really strange not having anal=
og for local classes.<div><br></div><div>void f()</div><div>{</div><div>&nb=
sp; auto F =3D []( auto p ) // OK<br> {</div><div> }</div><div>=
<br></div><div> struct C</div><div> {</div><div> i=
nt lalalalal; // helper fields</div><div> template<typename=
T> // C2892</div><div> void TF( T p )</div><div> &nb=
sp; {</div><div> }</div><div><br></div><div> void=
F( auto p ) // C3533</div><div> {</div><div> }</=
div><div> }</div><div><br></div><div> int a;</div><div> s=
tring b;</div><div><br></div><div> F(a); // ok</div><div> F(b);=
// ok</div><div><br></div><div> C obj;</div><div> obj.TF(a); /=
/_-</div><div> obj.TF(b); //_-<br> obj.F(a); //_-<br> obj=
..F(b); //_-</div><div>}</div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_619_17419934.1394821082329--
.
Author: Greg Marr <gregmmarr@gmail.com>
Date: Fri, 14 Mar 2014 12:54:57 -0700 (PDT)
Raw View
------=_Part_715_13440732.1394826897511
Content-Type: text/plain; charset=UTF-8
On Friday, March 14, 2014 2:18:02 PM UTC-4, ene...@develop-project.ru wrote:
> Since new generic lambda it really strange not having analog for local
classes.
>
> template<typename T> // C2892
> void F( auto p ) // C3533
For those not using or familiar with Visual C++:
C2892: local class shall not have member templates
Templated member functions are not valid in a class that is defined in a
function.
C3533: 'type': a parameter cannot have a type that contains 'auto'
void f(auto j){} // C3533
template<auto T> class C{}; // C3533
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_715_13440732.1394826897511
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div><font face=3D"arial, sans-serif">On Friday, March 14,=
2014 2:18:02 PM UTC-4, ene...@develop-project.ru wrote:</font></div><div><=
font face=3D"arial, sans-serif">> Since new generic lambda it really str=
ange not having analog for local classes.</font></div><div><font face=3D"ar=
ial, sans-serif">></font></div><div><font face=3D"arial, sans-serif">>=
; template<typename T> // C2892</font></div><div><font =
face=3D"arial, sans-serif">> void F( auto p ) // C3533</fo=
nt></div><div><font face=3D"arial, sans-serif"><br></font></div><div><font =
face=3D"arial, sans-serif">For those not using or familiar with Visual C++:=
</font></div><div><font face=3D"arial, sans-serif"><br></font></div><div><f=
ont face=3D"arial, sans-serif">C2892: local class shall not have member tem=
plates</font></div><div><font face=3D"arial, sans-serif">Templated member f=
unctions are not valid in a class that is defined in a function.</font></di=
v><div><font face=3D"arial, sans-serif"><br></font></div><div><font face=3D=
"arial, sans-serif">C3533: 'type': a parameter cannot have a type that cont=
ains 'auto'</font></div><div><font face=3D"arial, sans-serif">void f(auto j=
){} // C3533</font></div><div><font face=3D"arial, sans-serif">template<=
auto T> class C{}; // C3533</font></div><div><br></div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_715_13440732.1394826897511--
.
Author: Faisal Vali <faisalv@gmail.com>
Date: Fri, 14 Mar 2014 15:10:19 -0500
Raw View
--20cf30292138adbbaa04f496a892
Content-Type: text/plain; charset=ISO-8859-1
On Fri, Mar 14, 2014 at 1:18 PM, <enelar@develop-project.ru> wrote:
> Since new generic lambda it really strange not having analog for local
> classes.
>
> void f()
> {
> auto F = []( auto p ) // OK
> {
> }
>
> struct C
> {
> int lalalalal; // helper fields
> template<typename T> // C2892
> void TF( T p )
> {
> }
>
> void F( auto p ) // C3533
> {
> }
> }
>
> int a;
> string b;
>
> F(a); // ok
> F(b); // ok
>
> C obj;
> obj.TF(a); //_-
> obj.TF(b); //_-
> obj.F(a); //_-
> obj.F(b); //_-
> }
>
I would say that if you care enough about this issue, present (or write up)
some thoughtful use cases where the explicit use of local templates does
improve your code in some compelling fashion (as compared to what can be
best written without them - some have mentioned that not being able to
inject nested types within lambdas can be a limitation that could be better
overcome with local templates - though i know of no analysis that not only
attempts to gauge the importance of this use case, but also attempts to
examine the solution space more comprehensively) - and propose it to the
evolution working group.
Thanks!
-faisal
> --
>
> ---
> 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/.
>
--
---
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/.
--20cf30292138adbbaa04f496a892
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><div class=3D"gmail_extra"><div class=3D"gmail_quote">=
On Fri, Mar 14, 2014 at 1:18 PM, <span dir=3D"ltr"><<a href=3D"mailto:e=
nelar@develop-project.ru" target=3D"_blank">enelar@develop-project.ru</a>&g=
t;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-=
left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr">Since ne=
w generic lambda it really strange not having analog for local classes.<div=
><br>
</div><div>void f()</div><div>{</div><div>=A0 auto F =3D []( auto p ) // OK=
<br>=A0 {</div><div>=A0 }</div><div><br></div><div>=A0 struct C</div><div>=
=A0 {</div><div>=A0 =A0 int lalalalal; // helper fields</div><div>=A0 =A0 t=
emplate<typename T> // C2892</div>
<div>=A0 =A0 void TF( T p )</div><div>=A0 =A0 {</div><div>=A0 =A0 }</div><d=
iv><br></div><div>=A0 =A0 void F( auto p ) // C3533</div><div>=A0 =A0 {</di=
v><div>=A0 =A0 }</div><div>=A0 }</div><div><br></div><div>=A0 int a;</div><=
div>=A0 string b;</div><div>
<br></div><div>=A0 F(a); // ok</div><div>=A0 F(b); // ok</div><div><br></di=
v><div>=A0 C obj;</div><div>=A0 obj.TF(a); //_-</div><div>=A0 obj.TF(b); //=
_-<br>=A0 obj.F(a); //_-<br>=A0 obj.F(b); //_-</div><div>}</div></div></blo=
ckquote><div>
<br><br></div><div>I would say that if you care enough about this issue, pr=
esent (or write up) some thoughtful use cases where the explicit use of loc=
al templates does improve your code in some compelling fashion (as compared=
to what can be best written without them - some have mentioned that not be=
ing able to inject nested types within lambdas can be a limitation that cou=
ld be better overcome with local templates - though i know of no analysis t=
hat not only attempts to gauge the importance of this use case, but also at=
tempts to examine the solution space more comprehensively) - and propose it=
to the evolution working group.<br>
<br></div><div>Thanks!<br></div><div>-faisal<br></div><div><br>=A0</div><bl=
ockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-lef=
t:1px solid rgb(204,204,204);padding-left:1ex"><span class=3D""><font color=
=3D"#888888">
<p></p>
-- <br>
<br>
--- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" 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></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--20cf30292138adbbaa04f496a892--
.
Author: enelar@develop-project.ru
Date: Fri, 14 Mar 2014 13:36:44 -0700 (PDT)
Raw View
------=_Part_710_3084400.1394829404167
Content-Type: text/plain; charset=UTF-8
*Greg Marr*, thanks, didnt think that its important.
faisalv, ofc example far-fetched. I just feared in land of C++ developers
say word 'meta'.
Templates is bad solution of my problem -> we need generic functions in
special, hidden scope -> we need new instruments for linking stage -> we
get metaprogramming.
As few years earlier i ask my friend "why C++ havn`t compile-time
functions". Now i asking him "why C++ havn`t realtime class generation".
BTW.
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_710_3084400.1394829404167
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><b>Greg Marr</b>, thanks, didnt think that its important.<=
div><span class=3D"_username" style=3D"white-space: nowrap;"><span class=3D=
"GB-CK03DNSB">faisalv<span style=3D"font-weight: normal;">, ofc example&nbs=
p;</span></span></span><span style=3D"white-space: nowrap;">far-fetched. I =
just feared in land of C++ developers say word 'meta'.</span><br></div><div=
><span style=3D"white-space: nowrap;"><br></span></div><div><span style=3D"=
white-space: nowrap;">Templates is bad solution of my problem -> we need=
generic functions in special, hidden scope -> we need new instruments f=
or linking stage -> we get metaprogramming.</span></div><div><span style=
=3D"white-space: nowrap;"><br></span></div><div><span style=3D"white-space:=
nowrap;"><br></span></div><div><span style=3D"white-space: nowrap;">As few=
years earlier i ask my friend "why C++ havn`t compile-time functions". Now=
i asking him "why C++ havn`t realtime class generation". BTW.<br></span></=
div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_710_3084400.1394829404167--
.