// The power function on integer type arguments. #include // The general case: template struct Power{ static const unsigned int value = N * Power::value; }; // The base case, via template specialization: template struct Power { static const unsigned int value = 1; }; int main(){ std::cout << Power<5,3>::value << std::endl; // 25 std::cout << Power<5,5>::value << std::endl; // 625 std::cout << Power<5,7>::value << std::endl; // 15625 }