Memoized, recursive factorial function?

前端 未结 4 1024
庸人自扰
庸人自扰 2020-12-03 04:21

I know how to do memoization in Python easily but I need a faster way to compute them, so I am using C++. However, I have no clue how to memoize. I understand that it\'s abo

4条回答
  •  既然无缘
    2020-12-03 04:31

    Just for fun, here's a little generic memoizer I wrote some time ago. It requires variadic templates, naturally:

    template