Template metaprogramming: Difference between revisions

Content deleted Content added
ce: "output ... can include"
m Compile-time class generation: "... 0 and 4" to match the order in the example
Line 31:
// factorial(4) would yield 24.
</syntaxhighlight>
The code above will execute at run time to determine the factorial value of the literals 40 and 04.
By using template metaprogramming and template specialization to provide the ending condition for the recursion, the factorials used in the program—ignoring any factorial not used—can be calculated at compile time by this code:
<syntaxhighlight lang=cpp>