O'Reilly logo

C++ Common Knowledge: Essential Intermediate Programming by Stephen C. Dewhurst

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Item 55. Template Template Parameters

Let’s pick up the Stack template we considered in Specializing for Type Information [52, 183]. We decided to implement it with a standard deque, which is a pretty good compromise choice of implementation, though in many circumstances a different container would be more efficient or appropriate. We can address this problem by adding an additional template parameter to Stack for the container type used in its implementation.

template <typename T, class Cont>class Stack;

For simplicity, let’s abandon the standard library (not usually a good idea, by the way) and assume we have available a set of nonstandard container templates: List, Vector, Deque, and perhaps others. Let’s also assume these containers are ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required