May 2012
Intermediate to advanced
679 pages
16h 56m
English
We have so far seen examples with declaration like template<class T>.
It had only one parameter T. It is possible to have two arguments in a template declaration. We can declare a template as
template <class T , class N>
Now we are in a position to compare and contrast the function and class templates.
The rules for function template and class templates differ about the nature of the template arguments.
1. For declaring function templates, all the arguments in template declaration must be generic (class T). The declaration:
template <class T, class N > is perfectly valid, but the declaration
template <class T, int N> is invalid.
2. For class templates there is no such restriction. ...
Read now
Unlock full access