Template meta-programming is a meta-programming 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.
Template meta-programming is a meta-programming 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 template outputs include compile time constants, data structures and functions; this technique can be described as a "compile time" execution. It can be used to control the generation of optimized code based on the compile time type being used, and "static polymorphism" (also known by the pattern name CRTP).