Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2007-05-15 19:29:17

Maurizio Vitale wrote:
> What about introducing a macro:
> namespace boost { namespace proto { \
> template<typename E> \
> struct generate<DOMAIN, E> { \
> typedef EXPRESSION<E> type; \
> static type make (E const& expr) { \
> return type (expr); \
> } \
> }; \
> } }
> as far as I can tell one does never need something different from the above boilerplate code.
> (otherwise I'd like to see examples, for my own education)
> Not a big deal, I know, but looks nicer (and sound nicer in the docs as well, I think).

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.

> Have fun in Colorado!

Workin' on it! :-)

Eric Niebler
Boost Consulting

Boost list run by bdawes at, gregod at, cpdaniel at, john at