meaning of factorial<T - 1> in template definition
问题 I have difficulties to understand how the following template definition and template specialization definition work? To me, factorial<34> or factorial<T-1> look strange! For example: factorial<T - 1>::value means what? #include <iostream> template<int T> struct factorial { enum { value = factorial<T - 1>::value * T }; }; template<> struct factorial<1> { enum { value = 1 }; }; int main() { std::cout << factorial<34>::value << std::endl; } g++ -o testSTL01 testSTL01.cpp -Wall testSTL01.cpp: In