Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changes between Version 2 and Version 3 of code/Template


Ignore:
Timestamp:
Apr 12, 2017, 10:29:54 PM (8 years ago)
Author:
landauf
Comment:

fixed links

Legend:

Unmodified
Added
Removed
Modified
  • code/Template

    v2 v3  
    33== Description ==
    44
    5 A [wiki:template] is a class with an undefined type anywhere in it (for example a member variable, a function parameter or return value or even an undefined parent class). This undefined type gets replaced by a symbol. We'll usually use T as the symbol. Of course it's also possible to have more than one undefined type.
     5A [wiki:Template] is a class with an undefined type anywhere in it (for example a member variable, a function parameter or return value or even an undefined parent class). This undefined type gets replaced by a symbol. We'll usually use T as the symbol. Of course it's also possible to have more than one undefined type.
    66
    7 Possible applications for templates are: Generic lists that can store ints or strings or !MyClasses or other lists, a container that stores an element of a specific class, a [wiki:Factory], a stream and many more.
     7Possible applications for templates are: Generic lists that can store ints or strings or !MyClasses or other lists, a container that stores an element of a specific class, a [wiki:doc/Factory], a stream and many more.
    88
    99Because the exact specifications of templates aren't defined, the compiler can't just compile the template once. In fact the template gets compiled once in every source that uses the template. That's why it's not possible to just include the header file of a template. You always have to include the source too. This is why programmers usually write the whole code of the template into the header file.