Semua buku

Profesional

Aplikasi Tentang Pelatih Masuk Mulai membaca

Computer Science · Glosarium

Apa itu Template instantiation?

Definition 4.4 University Computer Science — Year 2 · Bab 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.
Baca dalam konteks →