The BOOST_PP_REPEAT_FROM_TO_z macro represents a reentry into the BOOST_PP_REPEAT_FROM_TO repetition construct.

Usage

BOOST_PP_REPEAT_FROM_TO_ ## z(first, last, macro, data)

Arguments

z
The next available BOOST_PP_REPEAT dimension.
first
The lower bound of the repetition.  Valid values range from 0 to BOOST_PP_LIMIT_MAG.
last
The upper bound of the repetition. Valid values range from 0 to BOOST_PP_LIMIT_MAG.
macro
A ternary operation of the form macro(z, n, data).  This macro is expanded by BOOST_PP_REPEAT with the next available repetition depth, the current repetition number, and the auxiliary data argument. 
data
Auxiliary data passed to macro.

Remarks

This macro expands to the sequence:
macro(z, first, data) macro(z, first + 1, data) ... macro(z, last - 1, data)
The number of repetitions (i.e. last - first) must not exceed BOOST_PP_LIMIT_REPEAT.
At certain times, it may be necessary to perform the concatenation with BOOST_PP_CAT rather than the preprocessor token-pasting operator.  This happens when the z value is a macro invocation itself.  It needs a delay to allow it to expand.  The syntax in such a scenario becomes:
BOOST_PP_CAT(BOOST_PP_REPEAT_FROM_TO_, z)(count, macro, data).

See Also

Requirements

Header:  <boost/preprocessor/repetition/repeat_from_to.hpp>

Sample Code

#include <boost/preprocessor/repetition/repeat_from_to.hpp>

#define TEXT(z, n, data) n data

#define MACRO(z, n, data) \
  ( \
     BOOST_PP_REPEAT_FROM_TO_ ## z( \
        1, 4, \
        TEXT, xyz \
     ) \
  ) \
  /**/

BOOST_PP_REPEAT(3, MACRO, _)
   /*
      expands to:
      (1 xyz 2 xyz 3 xyz)
      (1 xyz 2 xyz 3 xyz)
      (1 xyz 2 xyz 3 xyz)
   */

© Copyright Housemarque Oy 2002
© Copyright Paul Mensonides 2002

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at www.boost.org/LICENSE_1_0.txt)