From: Eric Niebler (eric_at_[hidden])
Date: 2008-03-20 17:50:06
Markus Werle wrote:
> Actually I thought that transforms only work on expr<>
> not on fusion sequences. I just don't want to switch the
> library in order to do all this CT magic.
Right, transforms accept expressions. There's nothing stopping you from
writing a transform that accepts an expression, creates a flat view, and
manipulates the flat view with Fusion algorithms. In fact, there is a
Proto transform that does just that: fold<>. When you use
transform::fold<Seq, State, Fun>, Seq is a transform that accepts an
expression and returns a Fusion sequence. The fold<> transform then just
calls fusion::fold() on that sequence.
Usually Seq is proto::_, which causes you to fold the children of the
current expression. That's because "_" is an identity transform ... it
just returns the expression passed to it. And expressions are valid
Fusion sequences of their children.
My point is, you don't have to "switch libraries" ... you can use them
both because they're designed to work together.
-- Eric Niebler 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