|
Boost : |
Subject: Re: [boost] Interest check: memoization
From: James Porter (porterj_at_[hidden])
Date: 2009-01-26 17:55:00
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
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk