Subject: Re: [boost] Interest check: memoization
From: James Porter (porterj_at_[hidden])
Date: 2009-01-27 02:52:29
> IMO the main issue is that we need to declare a variable, and in order to share this variable we need to either use a global variable or pass it as parameter to the inner functions. What do you think about defining a singleton type avoiding the need of this variable declaration, as do Boost.Flyweith?
> what about adding a _singleton variant
> typedef memoizer_singleton<doit> doit_memo;
> and use directly the type doit_memo as follows
I think I prefer this syntax, since it still allows for recursive
memoization, and doesn't allow for stateful function objects (results of
boost::bind, etc.). In order to share the results of boost::bind, you'd
have to do as you say and make a global or pass it to inner functions,
and if it's good enough in those situations, it should be sufficient
here as well.
These are all good suggestions, though. I think a library like this will
only really see use if the memoization code is largely invisible to
users, which means it has to mimic all the use cases for functions,
function objects, etc.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk