Template metaprogramming: Difference between revisions

Content deleted Content added
m Task 70: Update syntaxhighlight tags - remove use of deprecated <source> tags
Benefits and drawbacks of template metaprogramming: what standard? when? for what language?
Line 295:
 
==Benefits and drawbacks of template metaprogramming==
; Compile-time versus execution-time tradeoff : If a great deal of template metaprogramming is used.
; Compile-time versus execution-time tradeoff : If a great deal of template metaprogramming is used, compilation may become slow; section 14.7.1 [temp.inst] of the current standard defines the circumstances under which templates are implicitly instantiated. Defining a template does not imply that it will be instantiated, and instantiating a class template does not cause its member definitions to be instantiated. Depending on the style of use, templates may compile either faster or slower than hand-rolled code.
; [[Generic programming]] : Template metaprogramming allows the programmer to focus on architecture and delegate to the compiler the generation of any implementation required by client code. Thus, template metaprogramming can accomplish truly generic code, facilitating code minimization and better maintainability{{Citation needed|date=June 2014}}.
; Readability : With respect to C++, the syntax and idioms of template metaprogramming are esoteric compared to conventional C++ programming, and template metaprograms can be very difficult to understand.<ref>{{cite paper