Boost logo

Boost :

Subject: Re: [boost] Interest check: memoization
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-01-26 12:51:51


AMDG

Mathias Gaunard wrote:
>> arbitrary function
>> objects can have many overloads of operator(), and there would need
>> to be a way to specify which overload is associated with the memoizer.
>
>
> Can't you just do something like
>
> template<typename T1, typename T2, ..., typename Tn>
> result_type operator()(T1 t1, T2 t2, ..., Tn tn)
> {
> typedef boost::tuple<T1, T2, ..., Tn> tuple_type;

You'd need to be a bit careful about implicit conversions.

If you have a monomorphic function object that takes double arguments,
then passing ints and passing double will get memoized separately this way.

In Christ,
Steven Watanabe


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk