Understanding Partial Specialization

Understand the details of partial specialization in this lesson.

In the previous lesson, we explored a variant of template specialization (explicit or full specialization). In this lesson, we’ll take a closer look at partial specialization, which is the second form of template specialization.

Partial specialization

Partial specialization occurs when we specialize a primary template but only specify some of the template arguments. This means a partial specialization has both a template parameter list (which follows the template keyword) and a template argument list (which follows the template name). However, only classes can be partially specialized.

Let’s explore the following example to understand how this works:

Get hands-on with 1200+ tech skills courses.