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 46. Class Template Explicit Specialization

Class template explicit specialization is straightforward. First, you need a general case to specialize. This general case is called the “primary” template.

template <typename T> class Heap;

The primary template has only to be declared to be specialized (as Heap is above), but it is usually also defined (as Heap is below):

image

Our primary template implements a heap data structure by putting an easy-to-use interface around the somewhat challenging standard library heap algorithms. A heap is a linearized tree structure that is optimized for insertion and retrieval. Pushing a value into a heap inserts ...

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