|
Boost : |
Subject: Re: [boost] [fusion] Any chance we can incorporate more folds?
From: Larry Evans (cppljevans_at_[hidden])
Date: 2010-08-20 23:40:56
On 08/20/10 16:21, Steven Watanabe wrote:
[snip]
>
> We already have reverse_fold, which makes 2/4.
>
fusion::reverse_fold takes the sequence as the first argument.
In contrast, the haskell function takes the sequence as the last
argument. That wouldn't be a big problem except if you plan to
provide a variadic template:
http://www.osl.iu.edu/~dgregor/cpp/variadic-templates.html
version of these functions. The variadic template spec
requires the parameter pack to be at the end, IOW:
template<typename Op, typename State0, typename... Values)
foldl(Op,State0,Values&... values);
Which is exactly the way haskell orders the arguments.
I know this is different than the way fusion and mpl do it;
however, if arg packs (e.g. Values&... values) are to be used,
then I don't see any workaround.
-Larry
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk