Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-08-18 09:01:46


Larry Evans <cppljevans_at_[hidden]> writes:

> On 08/18/2005 12:07 AM, Bruno Martínez wrote:
>> On Wed, 17 Aug 2005 15:29:51 -0300, Larry Evans
> [snip]
>>>Makes perfect sense to me. The fold metafunction calculates
>>>a sequence of partial results which can then be accessed with
>>>child_i_depth_j as shown in test driver in:
>>
>>
>> The recursion in child_i_depth_j is a tail call. IIUC, the recursion is
>> like the first drop, so increasing depths don't share part of the
>> calculation. However, it could be written in the other style.
>
> Yeah, you're right. I was thinking more of how fold was done. It
> calculates all the intermediate results, but leaves no way to
> access them.

Of course you can use fold to build an O(1) access structure like
vector or a map containing all of your intermediate results, and then
access that.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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