Say I have this code:
template <int n>
class Factorial
{
public:
static const int f = Factorial<n-1>::f*n;
};
template<>
class Factorial<0>
{
public:
static const int f =1;
};
It's a template that's meant to compute a factorial. It should be computed at compile time. Is it generally reasonable (specifically: quicker) to perform computations via templates at compile time? P.S. Sorry if this has been asked and answered before, I searched for this particualr question and only found similar ones.