Template Metaprogramming Techniques

CeePlusPlus techniques that yield compile time solutions for problems usually determined at runtime:

Implementations:

Template metaprogramming stores information used for compile time calculations in the type system. Partial template specicialization handles special cases. Metaprograms use metafunctions and metavariables:

Interestingly, the C++ standard allows escaping template closures and HigherOrder? templates. This makes compiling a small LambdaCalculus -like language to C++ Templates nearly trivial. Unfortunately, the standard-prescribed maximal recursion depth is rather low (13 levels, I believe), but most compilers have a much larger limit, usually in the range of several hundred levels.


CategoryCppTemplates CategoryMetaprogramming


EditText of this page (last edited September 27, 2014) or FindPage with title or text search