Boost logo

Boost Users :

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


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

> I am initializing an array like:
>
> unsigned char tmp[256]={0, 1, 2, 3, ...}
>
> I feel like this is something Boost.Preprocessor could do for
> me, but am unable to find out how. Anyone know?

#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.)

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