Lecture overview -- Keyboard shortcut: 'u'  Previous page: Example of Policies with Templates -- Keyboard shortcut: 'p'  Next page: Example - Specialization of Point<C> to Point<char> -- Keyboard shortcut: 'n'  Lecture notes - all slides and notes together  slide -- Keyboard shortcut: 't'  Help page about these notes  Alphabetic index  Course home  Lecture 5 - Page 10 : 39
Notes about C++
Templates and The Standard Library
Template Specialization

It is possible to provide a special version of a template for a particular type of parameter

Template specialization can be used for both class templates and function templates

  • The C++ Programming Language: Page 341
 

  • Class template specialization

    • Can be used to provide a single and shared implementation for all pointer types

    • Example: vector<C> is specialized to vector<C*>

    • Details in §13.5 in The C++ Programming Language

 

Function templates can also be specialized