
On Mon, Feb 22, 2010 at 3:29 AM, David Greene
I want to process a list that looks something like this:
struct List : or_< comma< List, Item >, Item
{};
But rather than processing each item separately, I want to pass a fusion (or some other) sequence to a semantic action:
when< List, SomeAction(...)
{};
Ideally the argument to SomeAction would be a fusion sequence but I don't know how to produce one. This doesn't work:
when< List, SomeAction(flatten(_))
{};
because flatten is not a transform. I don't want to use fold_tree because I don't want to actually fold the sequence. SomeAction is something like this:
struct SomeAction : callable { template<typename Seq> void operator()(Seq range) { typedef ... iterator;
// Is this legal for fusion sequences? for(iterator i = begin(range), iend = end(range); i != iend; i = next(i)) { ... } } }
Is there a way to do this?
On a related note, I know I can use varag<> to match a function call expression with an arbitrary number of operands and invoke a transform on each operand. But how would I generate a fusion sequence of all the operands? In other words, with:
proto::function< X, proto::vararg<Y> >
how do I talk about the vararg<> part in a semantic action? CalculatorGrammar has a use of vararg but it uses fold<> to process it. I don't want to fold a sequence, I want to pass it to a transform.
I had something like
struct foo_tostr
: proto::or_
Thanks!
-Dave _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users