Templates are of great utility to programmers in C++, especially when combined with multiple inheritance and operator overloading. The C++ Standard Library provides many useful functions within a framework of connected templates.
C++ Preface to Template |
|
|
Templates are a feature of the
C++
programming language that allow functions and classes to operate
with
generic types. This allows a function or class to work on
many different
data types without being rewritten for each one.
Templates are of great utility to programmers in C++, especially when combined with multiple inheritance and operator overloading. The C++ Standard Library provides many useful functions within a framework of connected templates. Through templates C++ language provides parametric polymorphism which allows generic algorithms and data structures. When an instance of a class is created , the templates ensures the correct executions of the routines encapsulated in a class. Templates are compiled when required. Template works like a run-time code optimizer, reduces run time over head and memory foot prints. No code is generated until a template is instantiated, and when required, the compilers allow the inclusion of template-file in a project without generating linkage errors. |
|
|
|
|