###  | # Boost.Preprocessor ## Header <boost/preprocessor/repeat_from_to.hpp>

Prev Next Macros Headers

### #define BOOST_PP_REPEAT_FROM_TO(FIRST,LAST,MACRO,DATA)

Repeats the macro `MACRO(INDEX,DATA)` for `INDEX = [FIRST,LAST)`.

In other words, expands to the sequence:

    MACRO(FIRST,DATA) MACRO(BOOST_PP_INC(FIRST),DATA) ... MACRO(BOOST_PP_DEC(LAST),DATA)

For example,

    #define TEST(INDEX,DATA) DATA(INDEX);
    BOOST_PP_REPEAT_FROM_TO(4,7,TEST,X)

expands to:

    X(4); X(5); X(6);

### 2D and 3D repetition

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

### See

- BOOST_PP_FOR()
- BOOST_PP_LIMIT_DIM
- BOOST_PP_LIMIT_MAG

### Test

- repeat_test.cpp
- repeat_2nd_test.cpp

### #define BOOST_PP_REPEAT_FROM_TO_2ND

Obsolete, just use BOOST_PP_REPEAT_FROM_TO().

### #define BOOST_PP_REPEAT_FROM_TO_3RD

Obsolete, just use BOOST_PP_REPEAT_FROM_TO().

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.