template <int N> struct Factorial { enum { value = N * Factorial<N - 1>::value }; }; template <> struct Factorial<0> { enum { value = 1 }; }; const int x = Factorial<4>::value;
After the preliminary compilation, if we could magically see what the compiler created, we would really see:
const int x = 24; const int y = 1;
And will we see actual definitions for a struct Factorial multiple of it? If so, what would they look like? I am trying to wrap my head around this part of the metaprogramming process.
source share