25. Specialization

It ain’t what you don’t know that gets you into trouble.

It’s what you know for sure that just ain’t so.

– Mark Twain

Introduction

Template Parameters and Arguments

Types as Arguments; Values as Arguments; Operations as Arguments; Templates as Arguments; Default Template Arguments

Specialization

Interface Specialization; The Primary Template; Order of Specialization; Function Template Specialization

Advice

25.1. Introduction

Over the last two decades, templates have developed from a relatively simple idea to the backbone of most advanced C++ programming. In particular, templates are key to techniques for

• improving type safety (e.g., by eliminating the use of casts; §12.5);

• raising the general level of abstraction ...

Get The C++ Programming Language, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.