#include inline int power(const int& m, int n){ int r = 1; for(int k=1; k<=n; ++k) r*= m; return r; } template struct Power{ enum { value = Power::value * m }; }; template struct Power{ enum { value = 1 }; }; template inline int power(const int& m){ return power(m) * m; } template<> inline int power<1>(const int& m){ return m; } template<> inline int power<0>(const int& m){ return 1; } int main(){ std::cout << "power(2,10): " << power(2,10) << std::endl; std::cout << "power<10>(2): " << power<10>(2) << std::endl; std::cout << "Power<2,10>::value: " << Power<2,10>::value << std::endl; }