August 2012
Intermediate to advanced
976 pages
30h 17m
English
In some situations, it is not possible for the compiler to deduce the types of the template arguments. In others, we want to allow the user to control the template instantiation. Both cases arise most often when a function return type differs from any of those used in the parameter list.
As an example in which we want to let the user specify which type to use, we’ll define a function template named sum that takes arguments of two different types. We’d like to let the user specify the type of the result. That way the user can choose whatever precision is appropriate. ...
Read now
Unlock full access