|
Boost Users : |
Subject: Re: [Boost-users] [spirit] Cannot find assig_a in spirit 2.1
From: OvermindDL1 (overminddl1_at_[hidden])
Date: 2009-09-25 15:42:11
On Fri, Sep 25, 2009 at 1:41 PM, OvermindDL1 <overminddl1_at_[hidden]> wrote:
> On Fri, Sep 25, 2009 at 1:21 PM, Christian Henning <chhenning_at_[hidden]> wrote:
>> Hi there, I really liked the assign_a actor in classic spirit. Is
>> there something like that in spirit 2.1, aka, spirit::qi?
>
> That is because something like assign_a is worthless in QI.
>
> For example (from the docs), in Spirit.Classic:
> Â Â int i, j;
> Â Â std::string s;
> Â Â r = int_p[assign_a(i)] >> (+alpha_p)[assign_a(s)] >> int_p[assign_a(j,i)];
>
> Can be done in Spirit.QI by:
> Â Â int i, j;
> Â Â std::string s;
> Â Â r = int_[ref(i)=_1] >>(+alpha)[ref(s)=_1] >> int_[ref(j)=_1];
>
> Or even better, this will do the same thing, but will execute even faster:
> Â Â int i, j;
> Â Â std::string s;
> Â Â std::string str("123456 Hello 789");
> Â Â phrase_parse(str.begin(), str.end(), int_ >> +alpha >> int_,
> blank, i,s,j); // This will stuff 12345 into i, "Hello" into S, and
> 789 into j, *very* fast.
>
> Spirit2.1 is *so* much better, as you might be seeing. Â :)
Also, I just noticed this is not on the Spirit mailing list. You
should post Spirit related questions to the Spirit mailing list, will
get more and faster responses.
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