C++ Boost

Boost.Preprocessor

Header <boost/preprocessor/enum.hpp>


Prev Next Macros Headers

#define BOOST_PP_ENUM(COUNT,MACRO,DATA)

Generates a comma separated list.

In other words, expands to the sequence:

MACRO(0,DATA), MACRO(1,DATA), ..., MACRO(BOOST_PP_DEC(COUNT),DATA)

For example,

#define TYPED_PARAM(INDEX,DATA)\
  BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2,0,DATA),INDEX) BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM(2,1,DATA),INDEX)
BOOST_PP_ENUM(3,TYPED_PARAM,(X,x))

expands to:

X0 x0, X1 x1, X2 x2

2D and 3D repetition

BOOST_PP_ENUM() implements automatic recursion. 2D and 3D repetition are directly supported.

See

Test


Prev Next Macros Headers

Revised

© Copyright Housemarque Oy 2002

Permission to copy, use, modify, sell and distribute this document is granted provided this copyright notice appears in all copies. This document is provided "as is" without express or implied warranty, and with no claim as to its suitability for any purpose.