Template Argument Deduction

Posted on Sun 04 May 2014 in misc View Comments • Tagged with C++, generics

With automatic template deduction, it is possible to omit the template argument when instantiating a template function. The compiler will deduce the type from the actual parameter sent to the function. This is of course assuming there are no ambiguities.

For example:

template<class T>
T max(T x, T …

Continue reading