Boost logo

Boost Users :

From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2005-01-21 03:44:58


> -----Original Message-----
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Paul Mensonides

> #include <boost/preprocessor/repetition/enum.hpp>
>
> #define index(z, n, _) n
>
> unsigned char tmp[256] = { BOOST_PP_ENUM(256, index, ~) };
>
> #undef index
>
> (Note, however, that you can't go any higher than 256 repetitions.)

More specifically, the library cannot _directly_ generate more than 256
repetitions in one pass. You can do something like this, for example:

#define index(z, n, offset) n + offset

unsigned char tmp[512] = { BOOST_PP_ENUM(256, index, 0), BOOST_PP_ENUM(256,
index, 256) };

#undef index

Regards,
Paul Mensonides


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net