November 2002
Intermediate to advanced
552 pages
10h 52m
English
This chapter covers some further basic aspects of templates that are relevant to the practical use of templates: an additional use of the typename keyword, defining member functions and nested classes as templates, template template parameters, zero initialization, and some details about using string literals as arguments for function templates. These aspects can be tricky at times, but every day-to-day programmer should have heard of them.
typenameThe keyword typename was introduced during the standardization of C++ to clarify that an identifier inside a template is a type. Consider the following example:
template <typename T> class MyClass { typename T::SubType * ptr; … };
Here, the second typename ...
Read now
Unlock full access