###  | # Boost.Preprocessor ## Reference

Prev Next Macros Headers

# #include <boost/preprocessor/repeat.hpp>

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

2D and 3D repetition are supported with the BOOST_PP_REPEAT_2ND() and BOOST_PP_REPEAT_3RD() macros.

### Example

- duffs_device.c
- repeat_2d.c

### See

- BOOST_PP_FOR()
- BOOST_PP_LIMIT_MAG

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.