How do you write a universal memoization function in C++? -- StackOverflow
From Python to C++:
Writing Universal memoization function in C++
Looking for a way to implement a universal generic memoization function which will take a function and return the memoized version of the same?
Looking for something like @memo (from Norving's site) decorator in python.
def memo(f): table = {} def fmemo(*args): if args not in table: table[args] = f(*args) return table[args] fmemo.memo = table return fmemoGoing more general, is there a way to express decorators in C++?