Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template<int n> struct fac
- {
- enum { value = n * fac<n-1>::value };
- };
- template<> struct fac<0>
- {
- enum { value = 1 };
- };
- template<int n> struct fib
- {
- enum { value = fib<n-1>::value + fib<n-2>::value };
- };
- template<> struct fib<1>
- {
- enum { value = 1 };
- };
- template<> struct fib<0>
- {
- enum { value = 1 };
- };
Add Comment
Please, Sign In to add comment