
Mathias Gaunard wrote:
Well, bind has an unspecified return type, and that never bothered anyone. If you don't have auto, just don't make it a named variable.
Since you generally want to store the memoizer somewhere (it's basically a container), this isn't always appropriate. However, I realized that for monomorphic function objects, I can just deduce the signature of operator() so that the memoizer's type is simply memoizer<my_function_object>.
Can't you just do something like [snip]
I'm intentionally avoiding (type-) polymorphic function objects (or rather, I'm restricting them to one overload), since knowing the exact function signature allows for better type-safety and, as Steven mentioned, eliminates the chance of creating spurious maps to store the memoized values. I think the added restriction in terms of polymorphic function objects is worth the added safety with monomorphic types. If you are interested in looking at the new code, I have updated source available here: http://www.teamboxel.com/misc/memoizer-0.2.tar.gz . There's obviously a lot of work left to do, but hopefully this will help resolve some of your questions regarding function objects. - Jim