// template metaprogramming #include template struct fibonacci { enum { value = fibonacci::value + fibonacci::value }; }; template <> struct fibonacci<0> { enum { value = 0 }; }; template <> struct fibonacci<1> { enum { value = 1 }; }; int main() { std::cout << fibonacci<40>::value << std::endl; }