August 2012
Intermediate to advanced
976 pages
30h 17m
English
A class—either an ordinary class or a class template—may have a member function that is itself a template. Such members are referred to as member templates. Member templates may not be virtual.
As an example of an ordinary class that has a member template, we’ll define a class that is similar to the default deleter type used by unique_ptr (§ 12.1.5, p. 471). Like the default deleter, our class will have an overloaded function-call operator (§ 14.8, p. 571) that will take a pointer and execute delete on the given pointer. Unlike the default deleter, our class will also print a message whenever the deleter is executed. Because we want to use our deleter with any type, ...
Read now
Unlock full access