
On Fri, 16 Apr 2004 11:43:36 +0200 Michiel Salters <michiel.salters@logicacmg.com> wrote:
I'm wondering whether this can be generalized. Basically, I imagine a class "virtually" holding objects of some type T, with the restriction that it may not hold more than N actual objects of type T, and holds data<T> objects to create the other objects. You'd have a policy<T> which would create a T from a data<T> and later destroy it. The assumption is that a data<T> would be a lot cheaper than an actual T.
Thanks, Michiel! Great idea, and one that may be more beneficial to the masses. Currently, I implement a lru_cache, but it is specific. I believe just a little work would make it more generic, as you suggest (I kinda have that as I allow using FILE* or int - handling each specially, but having a policy manage those would make it very generic). I'll see if I can make some time over the weekend to work on it (between my son's baseball, and all the spring yardwork -- which includes moving ANOTHER 5 tons of pea gravel, wheelbarrow by wheelbarrow). -- Jody Hagins