It is clear that the former is slower to process for the compiler than the latter, and there is, as you say, evidence for this .
template<typename A>
void f(A const&);
template<typename A>
void f(A&);
template<typename A1, typename A2>
void f(A1 const&, A2&);
template<typename A1, typename A2>
void f(A1&, A2 const&);
template<typename A1, typename A2>
void f(A1 const&, A2 const&);
template<typename A1, typename A2>
void f(A1&, A2&);
template<typename ...T>
void f(T &&...);
I don't know a workaround for something completely common autoin C ++. Modeling autorequires hundreds, if not thousands of lines of code (see Boost.typeof), and then it is not yet common. The same for decltype.
source
share