Topic: [c++std-core-27199] An implementation


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Thu, 5 Mar 2015 21:09:55 +0200
Raw View
Dropping Core, this is not a Core discussion.

On 5 March 2015 at 20:10, 'Geoffrey Romer' via ISO C++ Standard -
Future Proposals <std-proposals@isocpp.org> wrote:
> My point is that the use of a generic, meaningless parameter name like "T"
> tacitly documents the fact that frob isn't going to dictate many additional
> constraints, beyond perhaps highly generic ones like being able to compare
> for equality.

void frob(auto); seemingly conveys the same information, once you get
used to it.
It also happens to be a nicely terse way to not write the
template-header boilerplate
for cases where you don't use that boilerplate for anything.

>> Do you have an example function body that works with frob(T) but doesn't
>> work with frob(auto) (or vice versa) for a specific concrete type?  I'm
>> really trying to understand the difference you see between these two forms.
> 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.

In
template <class T> void frob(T t)
{
    // I can use T here for various purposes
}
and in
void frob(auto t)
{
    // if I want to use 'T' here, I need to do a decltype(t) to get at it
}

--

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

.