Boost logo

Boost :

Subject: Re: [boost] [fusion] discrepancy between std::accumulate and fusion::accumulate
From: Joel de Guzman (joel_at_[hidden])
Date: 2008-09-19 13:30:42


Stjepan Rajko wrote:
> Hello,
>
> I just started playing with an abstracted accumulate function which
> can be called either with a fusion sequence or a range, and calls
> fusion::accumulate or std::accumulate as appropriate. In using it, I
> ran into an interesting discrepancy: std::accumulate expects binary
> functions which take the accumulator as the first argument and the
> sequence element as the second argument. fusion::accumulate expects
> the arguments in reverse. This discrepancy makes the abstraction
> unnecessarily complicated, because the binary function has to either
> be able to receive the arguments in either order, or be adapted (e.g.,
> with bind) for one of the cases. Or, I'm just missing something :-)
>
> I guess I just wanted to point this out - perhaps it might be a useful
> thing to mention in the docs. BTW, MPL follows the standard library
> convention.

Indeed. A bug. Fusion should follow std convention. Can you please
add a trac ticket? Sigh... this will be a breaking change. I wonder
why it went unnoticed :-(

Regards,

-- 
Joel de Guzman
http://www.boostpro.com
http://spirit.sf.net

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