Todos los libros

Profesional

Apps Acerca de Coach Iniciar sesión Empezar a leer

Computer Science · Glosario

¿Qué es Template instantiation?

Definition 4.4 University Computer Science — Year 2 · Capítulo 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.
Leer en el capítulo →