Template Metaprogramming
lastmod 2026-11-10created 2015-06-193 edits
Template Metaprogramming is a technique that uses C++ templates to perform computation or type manipulation at compile time. It uses template specialization and recursion to compute compile-time constants, or inspects type properties with type_traits to branch code generation. Boost.MPL is the representative library, and since C++11 much of it has become simpler with constexpr and variadic templates.
See also
Favorite site
References
-
A_gentle_introduction_to_Template_Metaprogramming_with_C++_-_CodeProject.pdf ↩