On Mar 1, 2006, at 10:00 AM, Anthony DeRobertis wrote: > Joe Van Dyk wrote: > >> 1. Templates (that aren't in the STL) scare me. > > #include <iostream> > > template<int i> struct Factorial { > static const int F = i * Factorial<i-1>::F; > }; > > template<> struct Factorial<1> { > static const int F = 1; > }; > > int main() { > std::cout << Factorial<5>::F << std::endl; > return 0; > } > > Now that wasn't so scary, right? Mine compiles faster: #include <iostream> int main( ) { std::cout << 120 << std::endl; }