Boost logo

Boost :

From: vesa_karvonen (vesa_karvonen_at_[hidden])
Date: 2002-03-08 15:22:46


--- In boost_at_y..., "David Abrahams" <david.abrahams_at_r...> wrote:
> From: "vesa_karvonen" <vesa_karvonen_at_h...>
> > Take BOOST_PP_REPEAT() for example.
> >
> > <--->
> > #define BOOST_PP_REPEAT(N,M,P)
> >
> > Repeats the macro M(I,P) for I = [0,N[.
> >
> > In other words, expands to the sequence:
> >
> > M(0,P) M(1,P) ... M(BOOST_PP_DEC(N),P)
> > <--->
> >
> > I don't know how to make this any simpler.

Actually, what I really meant here was that BOOST_PP_REPEAT() is such
a simple primitive that it should not be difficult to understand nor
use.

> M(0,P) M(1,P) ... M(N-1,P)
> ^^^
> Note: If N is 10, this will be the token 9, not 10-1.

I understand the motivation, but I want to make it obvious that there
is something "different" going on. Passing expressions like N+1 to PP
macros is something most PP library users seem to do when they start
using the library.

> For example:
>
> #define FOO(n, x) + BOOST_PP_CAT(x, n)
> BOOST_PP_REPEAT(3, FOO, bar) => + bar1 + bar2 + bar3

I'll continue adding examples to the macros that currently don't have
them.


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