Boost logo

Boost Users :

From: Mark Williams (mark.williams_at_[hidden])
Date: 2006-04-05 12:59:40


Is there any standard way, in a semantic action, to assign individual
elements of a struct that is set as a member of a closure? For example
suppose I have:-

struct foo {
  int a, b, c;
  std::string d;
  float e;
};

And I have this as member1 in my closure, which is then attached to a rule
that parses each of those struct member elements seperately, is there then a
standard way within the semantic actions in my rule to assign to foo.d, say,
without modifying the other values? It seems that my only option is to
either write my own functors to set each member seperately, or have the
individual elements as seperate members of my closure.

I kind of want to do something like this:
myrule = int_p[assign_a(myrule.m1.a)] >> int_p[assign_a(myrule.m1.b)];
But myrule.m1 is an actor, not an instance of foo.

Is there a way to do this with boost::bind perhaps?

I want to use closures since my rules need to be reentrant.

Mark


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net