Everything about Template metaprogramming
Metaprogramming technique
Template metaprogramming (TMP) is a metaprogramming technique in which 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 can include compile-time constants, data structures, and complete functions. The use of templates can be thought of as compile-time polymorphism. The technique is used by a number of languages, the best-known being C++, but also Curl, D, Nim, and XL. Wikipedia →
🧭 Start here: a 6-step reading path
- Read the overview: Template metaprogrammingA 5-minute orientation
- Pick up a classic book: C++ Template Metaprogramming in PracticeThe most-reprinted book on the subject
- Read the landmark paper: Discontinuous Galerkin method on three-dimensional tetrahedral grids. The use of template metaprogramming of the C++ languageCited 6 times
- Go sideways: Template (C++)A closely related topic
- Go sideways: Compile-time function executionA closely related topic
📖 Definitions
Noun A form of metaprogramming in which templates are used by a compiler to generate temporary source code, which is then merged with the rest of the source code and recompiled.
🏆 Landmark papers (most cited)
Discontinuous Galerkin method on three-dimensional tetrahedral grids. The use of template metaprogramming of the C++ language
Exceptions in remote procedure calls using C++ template metaprogramming
Template Metaprogramming Techniques for Concept-Based Specialization
APPLICATION OF TEMPLATE METAPROGRAMMING TECHNOLOGIES TO IMPROVE THE EFFICIENCY OF PARALLEL ARRAYS
A generic toolkit for multivariate fitting designed with template metaprogramming
Discontinuous Galerkin method on three-dimensional tetrahedral meshes. The usage of C++ template metaprogramming
LibDSL: a library for developing embedded domain specific languages in d via template metaprogramming
📚 Books worth reading
- 📕C++ Template Metaprogramming in PracticeWei Li · 2020
C++ template metaprogrammingDavid Abrahams · 2005- 📕Template Metaprogramming with C++Marius Bancila · 2022
Proceedings of the 2002 ACM SIGPLAN Haskell Workshop (Haskell '02)ACM SIGPLAN Haskell Workshop (2002 Pittsburgh, Pa.) · 2002
C++ template metaprogramming · 2004- 📕C++ Template Metaprogramming in PracticeLi Wei · 2020
Ranked by number of editions on Open Library, a rough measure of how lasting a book is.
🔗 Related topics
- Template (C++) 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…
- Compile-time function execution In computing, compile-time function execution (or compile-time function evaluation, or general constant expressions) is the ability of a compiler, that…
- Substitution failure is not an error Substitution failure is not an error (SFINAE) is a principle in C++ where an invalid substitution of template parameters is not in itself an error. David…
- Variadic template In computer programming, variadic templates or variation generics are templates that take a variable number of type parameters. They exist in several programmin…
- C++11 C++11 is a version of a joint technical standard, ISO/IEC 14882, by the International Organization for Standardization (ISO) and International Electrotechnical…
- Reflection (C++) Reflection in C++ refers to the usage of reflective programming, introduced to the C++ programming language in C++26. Reflection in C++, unlike other languages…
- Type variable In type theory and programming languages, a type variable is a mathematical variable ranging over types. Even in programming languages that allow mutable…
- Rank (computer programming) In computer programming, rank with no further specifications is usually a synonym for (or refers to) "number of dimensions"; thus, a two-dimensional array…