|
Boost Users : |
Subject: Re: [Boost-users] [xpressive] Using placeholder in semantic actions
From: Symons, Greg - SSD (Greg.Symons_at_[hidden])
Date: 2008-09-04 13:14:19
Eric Niebler wrote:
[snip]
>
> Xpressive overloads operators to give the impression that your can use a
> placeholder<T> as a T. But xpressive cannot overload operator. to give
> the impression of data member access because in C++ you can't overload
> operator..
Oh yeah... that would do it:) I'm glad you saw that right away, 'cause it would've taken me forever to wade through the source to figure out what I was doing wrong.
> Try this instead...
>
> xpressive::function<std::string ParsedUri::*>::type getHostname =
> {&ParsedUri::hostname};
>
> Now in your semantic actions, instead of doing this:
>
> [ result.hostname = host ]
>
> You can do this:
>
> [ result->*getHostname() = host ]
>
> Xpressive overloads operator->*, which is the closest thing to operator..
>
> Note to self: it would be better if we could leave off the parens in the
> above, like this: [ result->*getHostname = host ]. There's always more
> to do.
Thanks for the tip, it worked perfectly! Oh, and being able to leave off the parens would definitely be cool. The more I use xpressive, the more I really come to like it:)
-- Greg Symons Software Engineer ITT Corporation Space Systems Division greg.symons_at_[hidden] (260) 451-6402 This e-mail and any files transmitted with it may be proprietary and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender. Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of ITT Corporation. The recipient should check this e-mail and any attachments for the presence of viruses. ITT accepts no liability for any damage caused by any virus transmitted by this e-mail.
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