Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2005-09-16 16:50:24


"Joel de Guzman" <joel_at_[hidden]> wrote

> Arkadiy Vertleyb wrote:
> > Hi All,
> >
> > Do you think it makes sense to write a utility that, using a syntax like
> > following:
> >
> > template<class T, class U>
> > class foo /*typeof*/
> > {
> > . . .
> > };
> >
> > struct bar /*typeof*/
> > {
> > . . .
> > };
> >
> > // etc.
> >
> > would generate the typeof registrations? I think it could be quite
helpful
> > to those library authors who want to make their libs typeof-enabled,
since
> > it would minimise the duplication issue...
> >
> > This utility could be written using Spirit or maybe Python or any other
> > suitable tool.
>
> YES!!!

I played with this a bit (using Spirit), and the most challenging part seems
to be parsing the default parameters, which can be complicated expressions,
for example:

template<class T, int n = traits<T*>::size + 1> class x{};

I don't actually need to parse it, just to skip till the next comma or angle
bracket (considering nesting). What would be the easiest way to accomplish
this? A custom parser?

Also, maybe I am re-inventing the wheel -- are there any Spirit parsers to
assist in working with the C++ grammar?

Regards,
Arkadiy


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk