Boost logo

Boost :

Subject: Re: [boost] Interest check: memoization
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-01-24 23:32:27


James Porter wrote:
> After hacking around with some simple dynamic programming, it occurred
> to me that it should be possible to write a simple class template to
> handle memoization of functions. With the changes in C++0x that help
> solve the forwarding problem, writing a generic memoizer should be
> fairly straightforward. (Or so I thought!)
> Comments and criticisms are welcome. If there's interest, I will - of
> course - work on a version that supports the current C++ standard.

The implementation of less in upgradable_tuple_inner doesn't look quite

        return get(as_ref) < rhs.get(rhs_as_ref)
            || tail.less(as_ref,rhs.tail,rhs_as_ref);

Shouldn't this be

        return get(as_ref) < rhs.get(rhs_as_ref)
            || (!(rhs.get(rhs_as_ref) < get(as_ref)) &&

Also, upgradable_tuple_inner::upgrade isn't exception safe.

Fairly minor and maybe I shouldn't be worrying about them at this stage,
but still...

In Christ,
Steven Watanabe

Boost list run by bdawes at, gregod at, cpdaniel at, john at