//from "C++ Template as Partial Evaluation"

template<int N>
class Pow
{
public:
 static const int result = Pow<N-1>::result * N;
};

class Pow<1>
{
public:
 static const int result = 1;
};

//...
 const int a = Pow<5>::result;
//...