template
struct Factorial {
enum { value = n * Factorial::value};
};
template<>
struct Factorial<0> {
enum {val
i am learning basics of TMP, and want to know the result at compile to make sure logic is correct.
In that case, what you really want is a static assertion:
static_assert(Factorial<5> ::value == 120, "5! should be 120");
static_assert(Factorial<10>::value == 3628800, "10! should be 3628800");
If your compiler does not support static_assert yet, you can use BOOST_STATIC_ASSERT.