Boost logo

Boost :

Subject: [boost] [fusion] discrepancy between std::accumulate and fusion::accumulate
From: Stjepan Rajko (stipe_at_[hidden])
Date: 2008-09-19 09:35:27


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.

Kind regards,

Stjepan


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