Specialization

Let's learn about template specialization in this lesson.

Specialization

Template specialization addresses the need to have different code for different template argument types. Templates define the behavior of families of classes and functions.

  • Often it is necessary that special types, non-types, or templates as arguments are treated as special.
  • You can fully specialize templates; class templates can even be partially specialized.
  • The methods and attributes of specialization don’t have to be identical.
  • General or Primary templates can coexist with partially or fully specialized templates.

The compiler prefers fully specialized to partially specialized templates and partially specialized templates to primary ...