Chapter 16. Templates and Generic Programming

CONTENTS

Section 16.1 Template Definitions 624

Section 16.2 Instantiation 636

Section 16.3 Template Compilation Models 643

Section 16.4 Class Template Members 647

Section 16.5 A Generic Handle Class 666

Section 16.6 Template Specializations 671

Section 16.7 Overloading and Function Templates 679

Chapter Summary 683

Defined Terms 683

Generic programming involves writing code in a way that is independent of any particular type. When we use a generic program we supply the type(s) or value(s) on which that instance of the program will operate. The library containers, iterators, and algorithms described in Part II are examples of generic programming. There is a single definition of each container, such ...

Get C++ Primer, Fourth 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.