Template Metaprogramming
From cppreference.com
Template metaprogramming is a family of techniques to create new types and compute values at compile time. C++ templates are Turing complete if there are no limits to the amount of recursive instantiations and the number of allowed state variables. Erwin Unruh was the first to demonstrate template metaprogramming at a committee meeting by instructing the compiler to print out prime numbers in error messages. The standard recommends an implementation support at least 1024 levels of recursive instantiation, and infinite recursion in template instantiations is undefined behavior.
This section is incomplete Reason: Techniques (specializations, SFINAE, ADL, index sequences, folds, constxpr if, etc) |
This section is incomplete Reason: Terms (traits, typelists, metafunctions, etc) |
This section is incomplete Reason: Libraries Boost.MPL / Boost.Mp11 / Metal / Kvasir.MPL / Boost.Hana / etc (maybe even Loki from the dark ages) |
This section is incomplete Reason: History maybe |
External links
- David Vandevoorde, Nicolai M. Josuttis, Douglas Gregor (2017), C++ Templates - The Complete Guide, 2nd Edition.
- Wikibook: Template Meta-Programming.
- Wikipedia: Template Meta-Programming.