2009/8/12 Hicham Mouline <hicham@mouline.org>
Hello,

I have
const size_t MaxNumber = 16;

Can I generate this:
const size_t elts[MaxNumber] = {0, 1, ..., 15};

with Boost.PP?

I suppose I need to #define MaxNumber for PP?

#include <iostream>
#include <iterator>
#include <boost/preprocessor.hpp>

#define N 16

int main() {
  const int elts[] = { BOOST_PP_ENUM_PARAMS(N, BOOST_PP_EMPTY()) };
  std::copy(elts, elts + N, std::ostream_iterator<int>(std::cout, "\n"));

Roman Perepelitsa.