Tous les livres

Professionnel

Applis À propos Coach Connexion Commencer la lecture

Computer Science · Glossaire

Qu'est-ce que « Template instantiation » ?

Definition 4.4 University Computer Science — Year 2 · Chapitre 4 — Templates and Generic Programming

Template instantiation is the generation, by the compiler, of a function or a class from a template and a list of template arguments, by substituting the arguments for the parameters. A use such as Vec<int> or larger(3, 7) causes the instantiation; a member function of a class template is instantiated only if it is used.

One template, two translation units, two argument lists. Each unit instantiates what it uses; the linker merges the two copies of Vec<int>::push_back.
One template, two translation units, two argument lists. Each unit instantiates what it uses; the linker merges the two copies of Vec<int>::push_back.
Lire dans le chapitre →