C++ Boost

Boost.Preprocessor

Header <boost/preprocessor/repeat.hpp>


Prev Next Macros Headers

#define BOOST_PP_REPEAT(COUNT,MACRO,DATA)

Repeats the macro MACRO(INDEX,DATA) for INDEX = [0,COUNT).

In other words, expands to the sequence:

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

For example,

#define TEST(INDEX,DATA) DATA(INDEX);
BOOST_PP_REPEAT(3,TEST,X)

expands to:

X(0); X(1); X(2);

2D and 3D repetition

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

Example

See

Test


#define BOOST_PP_REPEAT_2ND

Obsolete, just use BOOST_PP_REPEAT().


#define BOOST_PP_REPEAT_3RD

Obsolete, just use BOOST_PP_REPEAT().


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.