BOOST_PP_ITERATE

The BOOST_PP_ITERATE macro initiates a file-iteration.

#### Usage

#include BOOST_PP_ITERATE()

#### Remarks

Arguments to this macro are passed as external named arguments in one of two ways--either through BOOST_PP_FILENAME_x and BOOST_PP_ITERATION_LIMITS or through BOOST_PP_ITERATION_PARAMS_x.
Three pieces of information are required to perform a file-iteration. First, the name of a file to iterate over. This is passed via BOOST_PP_FILENAME_x or as part of BOOST_PP_ITERATION_PARAMS_x. The file-iteration mechanism will repeatedly include this file with iteration values ranging from a lower bound to an upper bound--the second and third required parameters. These two boundaries are either passed through BOOST_PP_ITERATION_LIMITS or as part of BOOST_PP_ITERATION_PARAMS_x.
Optionally, a fourth parameter may be passed that associates flags with an iteration. These flags are primarily useful to distinguish one iteration from another in the same file. This parameter can only be passed through BOOST_PP_ITERATION_PARAMS_x.
While a file-iteration is in progress, BOOST_PP_IS_ITERATING is defined as 1.

#### See Also

- BOOST_PP_FILENAME_x
- BOOST_PP_IS_ITERATING
- BOOST_PP_ITERATION_LIMITS
- BOOST_PP_ITERATION_PARAMS_x

#### Requirements

Header: <boost/preprocessor/iteration/iterate.hpp>

#### Sample Code

    // file.h
    #if !BOOST_PP_IS_ITERATING

       #ifndef FILE_H_
       #define FILE_H_

       #include <boost/preprocessor/iteration/iterate.hpp>

       #define BOOST_PP_ITERATION_PARAMS_1 (3, (1, 10, "file.h"))
       #include BOOST_PP_ITERATE()

       #define BOOST_PP_FILENAME_1 "file.h"
       #define BOOST_PP_ITERATION_LIMITS (11, 20)
       #include BOOST_PP_ITERATE()

       #endif

    #else

       current iteration value is BOOST_PP_ITERATION()

    #endif

© 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)