February 2005
Beginner to intermediate
272 pages
4h 53m
English
Let’s get it straight: you can’t partially specialize function templates. It’s just not a part of the C++ language (although it may be some day). What you probably want to do is overload them (see Overloading Function Templates [58, 213]). Accordingly, we are considering only class templates in this item.
The way class template partial specialization works is straightforward. As with complete specialization, you first need a general case—or primary template—to specialize. Let’s use our Heap template from Class Template Explicit Specialization [46, 155]:
template <typename T> class Heap;
Explicit specialization (also known colloquially as “complete” specialization) is used to customize a class template ...
Read now
Unlock full access