#include <iostream>using namespace std;template <unsigned n>struct Factorial{enum {value = n * Factorial < n - 1 >::value};};template < >struct Factorial<0>{enum {value = 1};};int main(){cout << Factorial<3>::value << endl;return 0;}
原文:http://www.cnblogs.com/fengkang1008/p/4652205.html