Can the auto
keyword in C++11 replace function templates and specializations? If yes, what are the advantages of using template functions and specializations over
Can the
auto
keyword in C++11 replace function templates and specializations?
No. There are proposals to use the keyword for this purpose, but it's not in C++11, and I think C++14 will only allow it for polymorphic lambdas, not function templates.
If yes, What are the advantages of using template functions and specializations over simply typing a function parameter as
auto
.
You might still want a named template parameter if you want to refer to the type; that would be more convenient than std::remove_reference
or whatever.