Boost logo

Boost :

From: Matt Hurd (matt.hurd_at_[hidden])
Date: 2005-05-04 21:33:54


> > Joel <joel_at_[hidden]> wrote:
> Arkadiy Vertleyb wrote:
> > "Andrei Alexandrescu (See Website For Email)"
> > <SeeWebsiteForEmail_at_[hidden]> wrote
> >
> >
> >>... So I think it's entirely reasonable that building boost might
> >>generate C++ using *other* tools. I bet such an approach would lead to
> >>more maintainable and easy-to-understand code (only requiring knowledge
> >>of general tools that should be in a boost developer's toolchest anyway)
> >>instead of using the PP programming paradigm, of which learning I
> >>believe is less rewarding.
> >
> >
> > Interesting... Can you provide an example of how would such a tool generate
> > C++ based on the library user input... Lets just start with the simplest
> > one: the user wants to set maximum size of the mpl::vector<> to 50... Can
> > you explain how that would be achieved with an external tool?
>
> For example, we can have a python script that will generate header
> files for vector0 .. vector50 given some user supplied configs (with
> defaults). I remember some people doing that before boost PP became
> the norm (e.g. boost.python).
>
> However... see my other post.

I have a simple problem and will write a trivial cpp program to do it,
but perhaps someone has an idea of a better way to do it.

The wish is to have a compile time string that is an MPL vector of
char so that I can write a compile time parser with certain features.
A bit like the xpressive static mode with a bit of spirit thrown in...

I can't see a way of doing it nicely with the PP. This strikes me as
an example of something that makes you reach for something outside the
PP.

In this case it is just a simple substitution.

Source
    __cts"a string"

Result
   typedef mpl::vector<char, 'a',' ','s','t','r','i','n','g'> cts_a_string

Or some such...

Any thoughts?

Matt.
matthurd_at_[hidden]


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