
Mathias Gaunard wrote:
Why not simply
auto g = memoize(f); /* type of g is unspecified, using auto for automatic type deduction */
That's the plan, but I was writing for gcc 4.3, and auto is only available in gcc 4.4. :)
Does your memoize adaptor require knowing the signatures of the function object?
It can only memoize one function (or method) at a time, since it stores tuples of the arguments used to call the function, and assumes that the tuples are all of the same type. It's simple for function pointers, since they only have one type list for arguments, and simple for Boost/TR1 function objects for the same reason, but arbitrary function objects can have many overloads of operator(), and there would need to be a way to specify which overload is associated with the memoizer. - Jim