Dukales

Ackermann function

Jun 2nd, 2015
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. #include <cstddef>
  2.  
  3. template< std::size_t m, std::size_t n >
  4. constexpr std::size_t a = a< (m - 1), a< m, (n - 1) > >;
  5.  
  6. template< std::size_t m >
  7. constexpr std::size_t a< m, 0 > = a< (m - 1), 1 >;
  8.  
  9. template< std::size_t n >
  10. constexpr std::size_t a< 0, n > = (n + 1);
  11.  
  12. static_assert(a< 5, 3 > == 253);
Advertisement
Add Comment
Please, Sign In to add comment