|
|
|
Template (Programming): C+ +, Generic Programming, Datatype, Multiple Inheritance, Operator Overloading, C+ + Standard Library
|
 (Buch) |
Dieser Artikel gilt, aufgrund seiner Grösse, beim Versand als 2 Artikel!
| Inhalt: |
| High Quality Content by WIKIPEDIA articles! 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. There are two kinds of templates: function templates and
class templates. In the first two cases, the template argument T is
automatically deduced by the compiler to be int and double,
respectively. In the third case deduction fails because the type of the
parameters must in general exactly match the template arguments. This
function template can be instantiated with any copy-constructible type
for which the expression (y < x) is valid. For user-defined types,
this implies that the less-than operator must be overloaded. |
|