|
Boost : |
From: Maurizio Vitale (mav_at_[hidden])
Date: 2007-05-15 21:29:05
Eric Niebler <eric_at_[hidden]> writes:
> Maurizio Vitale wrote:
>> What about introducing a macro:
>>
>> #define BOOST_PROTO_WRAP(DOMAIN,EXPRESSION) \
[cut]
>
> I agree, this part of proto isn't as nice as it could be. I've
> considered making the expression generator a template parameter to the
> proto::domain, something like:
>
> struct my_domain
> : proto::domain< struct my_grammar, struct my_generator >
> {};
>
> This way, you wouldn't have to open proto's namespace to specialize
> proto::generate. I haven't thought too hard about it, though. I do know
> that I would like to avoid macros in proto's interface as much as possible.
Instead of the macro I was thinking about defining the generator inside my_domain.
If the code is really always the same, it is not even necessary to define the complete
generator, just the expression to wrap around proto expressions.
I think where the wrapper is used, my_context is available.
If this is doable it would encapsulate the wrapper inside the domain, which is where it belongs.
Unless there're legitimate uses for the same domain wrapped differently.
But then there's too much of proto I don't know, and I just proposed the macro...
Regards,
Maurizio
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk