Boost logo

Boost :

From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2003-01-02 02:17:53


Paul Mensonides wrote:
> ----- Original Message -----
> From: "Aleksey Gurtovoy" <agurtovoy_at_[hidden]>
>
> > > #define NUMBERS \
> > > (0)(1)(2)(3)(4)(5)(6)(7)(8)(9) \
> > > (10)(11)(12)(13)(14)(15)(16)(17)(18)(19) \
> > > /* ... */
> > >
> > > #define RANGE(first, length) \
> > > BOOST_PP_SEQ_SUBSEQ( NUMBERS, first, length ) \
> > > /**/
> > >
> > > BOOST_PP_SEQ_FOLD_LEFT(AUX_MAX_ARITY_OP, -1, RANGE(0, 5))
> > >
> >
> > Looks good! How efficient is it? For instance, if NUMBERS
> > is a sequence from 0 to 255?
>
> It should be very efficient. The length of the input doesn't
> matter, the length of the output range matters slightly.

Oh, good!

> Actually, if you only need a range starting from zero, you can
> use BOOST_PP_SEQ_FIRST_N instead of BOOST_PP_SEQ_SUBSEQ which will
> be more efficient yet.

OK, will have it in mind.

Thanks,
Aleksey


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