On Friday, 13 March 2015 at 02:38:18 UTC, Rikki Cattermole wrote:
You could assign it to e.g. an enum. Or force it over using meta-programming.

And this code can be rewritten to D?

template <int n>
struct Factorial
{
    enum { value = n * Factorial<n - 1>::value };
};

template <>
struct Factorial<0>
{
    enum { value = 1 };
};

int main()
{
    constexpr auto x = Factorial<5>::value;
    constexpr auto y = Factorial<7>::value;
}

Reply via email to