26. Instantiation

For every complex problem, there is an answer that is clear, simple, and wrong.

– H. L. Mencken

Introduction

Template Instantiation

When Is Instantiation Needed?; Manual Control of Instantiation

Name Binding

Dependent Names; Point-of-Definition Binding; Point-of-Instantiation Binding; Multiple Instantiation Points; Templates and Namespaces; Overaggressive ADL; Names from Base Classes

Advice

26.1. Introduction

One of the great strengths of templates is that they are an extremely flexible mechanism for composition of code. To produce impressive code quality, a compiler combines code (information) from

• the template definition and its lexical environment,

• the template arguments and their lexical environment, and

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.