Topic: [c++std-core-27202] [std-proposals] Re:
Author: "'Geoffrey Romer' via ISO C++ Standard - Discussion" <std-discussion@isocpp.org>
Date: Thu, 5 Mar 2015 14:37:42 -0800
Raw View
--001a113535064cb36c051092370c
Content-Type: text/plain; charset=UTF-8
On Thu, Mar 5, 2015 at 12:28 PM, Tom Honermann <thonermann@coverity.com>
wrote:
> On 03/05/2015 01:10 PM, 'Geoffrey Romer' via ISO C++ Standard - Future
>
>> I'm not aware of any code that will work with one form but not the
>> other. My point is simply that "auto" conveys less information to me as
>> a human reader than a named template parameter would.
>>
>
> I've felt concerns about this as well, specifically with respect to
> behavioral differences observable in template functions vs non-template
> functions.
>
> We all know that there is one object with static storage duration defined
> by this function:
> void f(int i) {
> static int invoke_count;
> ++invoke_count;
> }
>
> And we all know that there are potentially many objects with static
> storage duration defined by this template function, one for each
> instantiation:
> template<typename T>
> void f(int i) {
> static int invoke_count;
> ++invoke_count;
> }
>
> But, it is less apparent how many objects with static storage duration are
> defined by this function:
> void f(auto t) {
> static int invoke_count;
> ++invoke_count;
> }
>
> I don't know that this is a significant concern. But it is enough to give
> me pause.
Another one: which of these definitions can safely be in a header file?
> I've personally never minded the template boilerplate, but I guess I'm
> weird that way.
Me neither, and in fact I don't see the template header as "boilerplate" at
all. The only template boilerplate I mind is having to spell out
template <typename T, typename U, typename V>
MyClassName<T,U,V>::
over and over for every method I define outside the class body, but I don't
think abbreviated template syntax helps with that.
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussion+unsubscribe@isocpp.org.
To post to this group, send email to std-discussion@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-discussion/.
--001a113535064cb36c051092370c
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">=
On Thu, Mar 5, 2015 at 12:28 PM, Tom Honermann <span dir=3D"ltr"><<a hre=
f=3D"mailto:thonermann@coverity.com" target=3D"_blank">thonermann@coverity.=
com</a>></span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"mar=
gin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 03/05/2015 0=
1:10 PM, 'Geoffrey Romer' via ISO C++ Standard - Future<span class=
=3D""><br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">
I'm not aware of any code that will work with one form but not the<br>
other. My point is simply that "auto" conveys less information to=
me as<br>
a human reader than a named template parameter would.<br>
</blockquote>
<br></span>
I've felt concerns about this as well, specifically with respect to beh=
avioral differences observable in template functions vs non-template functi=
ons.<br>
<br>
We all know that there is one object with static storage duration defined b=
y this function:<br>
=C2=A0 void f(int i) {<br>
=C2=A0 =C2=A0 static int invoke_count;<br>
=C2=A0 =C2=A0 ++invoke_count;<br>
=C2=A0 }<br>
<br>
And we all know that there are potentially many objects with static storage=
duration defined by this template function, one for each instantiation:<br=
>
=C2=A0 template<typename T><br>
=C2=A0 void f(int i) {<br>
=C2=A0 =C2=A0 static int invoke_count;<br>
=C2=A0 =C2=A0 ++invoke_count;<br>
=C2=A0 }<br>
<br>
But, it is less apparent how many objects with static storage duration are =
defined by this function:<br>
=C2=A0 void f(auto t) {<br>
=C2=A0 =C2=A0 static int invoke_count;<br>
=C2=A0 =C2=A0 ++invoke_count;<br>
=C2=A0 }<br>
<br>
I don't know that this is a significant concern.=C2=A0 But it is enough=
to give me pause.</blockquote><div><br></div><div>Another one: which of th=
ese definitions can safely be in a header file?</div><div>=C2=A0</div><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #cc=
c solid;padding-left:1ex">=C2=A0 I've personally never minded the templ=
ate boilerplate, but I guess I'm weird that way.</blockquote><div><br><=
/div><div>Me neither, and in fact I don't see the template header as &q=
uot;boilerplate" at all. The only template boilerplate I mind is havin=
g to spell out<br></div><div><br></div><div>template <typename T, typena=
me U, typename V></div><div>MyClassName<T,U,V>::</div><div>=C2=A0<=
/div><div>over and over for every method I define outside the class body, b=
ut I don't think abbreviated template syntax helps with that.</div></di=
v></div></div>
<p></p>
-- <br />
<br />
--- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Discussion" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-discussion+unsubscribe@isocpp.org">std-discus=
sion+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-discussion@isocp=
p.org">std-discussion@isocpp.org</a>.<br />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-discussion/">http://groups.google.com/a/isocpp.org/group/std-discussion=
/</a>.<br />
--001a113535064cb36c051092370c--
.