Boost logo

Boost :

Subject: Re: [boost] [Fusion] fold takes state by cref. Why ?
From: Joel Falcou (joel.falcou_at_[hidden])
Date: 2011-04-11 13:55:17

On 11/04/11 01:42, Joel de Guzman wrote:
> On 4/10/2011 10:30 PM, Joel Falcou wrote:
>> Why is the State passed by const reference ? I have a couple of use
>> case (like using fold
>> to access the element (i0,...,in) of a fusion
>> sequence of pointer to ... pointer to T array) where I need to be
>> able to discriminate the
>> constness of the State to forward to
>> the proper PFO overload of operator().
> The type of 'State' may change on each iteration, so in general,
> there really is no sense in having a mutable 'State'. It is
> essentially pure FP. Having said that, there is no technical
> reason why we can't allow a non-const state -it's just another
> overload. It might also be useful for cases where the 'State'
> type remains constant. I added such overloads. I'll commit as
> soon as all tests pass.
> Regards,
Perfect :)

More generally it could be nice to have mutable version fo stuff like
zip (zipign two reference of sequence) or for_each.
FP is dandy and all but like with Phoenix, we live in a mutable language
so we may need this.

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