C++ meta programming: recursive template functions

C++ provides a few mechanisms for meta programming through its automatic type deduction tools, and the templating engine.  This allows for example, compile time evaluation of constants, loop unpacking.

We’ll demonstrate a way to use recursive template functions to evaluate a factorial at compile time, and do loop unpacking. A rough evaluation of the efficacy of these hand micro-optimisations  is also considered.

Continue reading “C++ meta programming: recursive template functions”