Content deleted Content added
Corrected link to [Lisp (programming language)] that erroneously pointed to [Lisp] (the speech impediment) |
m Correct term |
||
Line 2:
{{Programming paradigms}}
'''Template metaprogramming''' ('''TMP''') is a [[metaprogramming]] technique in which [[Generic programming|templates]] are used by a [[compiler]] to generate temporary [[source code]], which is merged by the compiler with the rest of the source code and then compiled. The output of these templates include [[compile time|compile-time]] [[constant (programming)|constant]]s, [[data structure]]s, and complete [[function (computer science)|function]]s. The use of templates can be thought of as [[Compile
Template metaprogramming was, in a sense, discovered accidentally.<ref name="Meyers2005">{{cite book|author=Scott Meyers|title=Effective C++: 55 Specific Ways to Improve Your Programs and Designs|url=https://books.google.com/books?id=Qx5oyB49poYC&q=%22Template+metaprogramming%22|date=12 May 2005|publisher=Pearson Education|isbn=978-0-13-270206-5}}</ref><ref>See [[wikibooks:C++ Programming/Templates/Template Meta-Programming#History of TMP|History of TMP]] on Wikibooks</ref>
Line 54:
==Compile-time code optimization==
{{see also|Compile
The factorial example above is one example of compile-time code optimization in that all factorials used by the program are pre-compiled and injected as numeric constants at compilation, saving both run-time overhead and memory footprint. It is, however, a relatively minor optimization.
Line 333:
* [[Expression templates]]
* [[Variadic Templates]]
* [[Compile
==References==
|