I would like to know if the standard committee considered expanding the C++14 auto
keyword to deduce function template parameter type, as it exists today in generic lambdas. (as can be seen nicely depicted in this answer)
Because it works in lambda functions, it should also work in any function. Of course it would be totally redundant with the classic syntax:
template< typename T >
void f(T param);
But being able to write this, for the same result:
void f(auto param);
I think would allow for less clogged code (shorter neater cleaner) and allow a great consistency in this use case:
auto v = func1();
f(v);
As you can see, we used the auto type deducer to declare v
, but then we have to use either a hard-typed parameterized function f, or a templated f.
In combination with auto
we should use auto
, that would be more consistent.
EDIT: this question indeed asks effectively the same thing, but less directly. And has yet to get the answer that user657267 gives, which I reproduce and extend thereunder.