forked from boostorg/preprocessor
initial revision
[SVN r15198]
This commit is contained in:
73
docs.1/ref/iterate.html
Normal file
73
docs.1/ref/iterate.html
Normal file
@ -0,0 +1,73 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>BOOST_PP_ITERATE</title>
|
||||
<link rel="stylesheet" type="text/css" href="../styles.css">
|
||||
<script language="javascript" type="text/javascript" src="../scripts.js"></script>
|
||||
</head>
|
||||
<body onload="init('sample');">
|
||||
<div style="margin-left: 0px;">
|
||||
The <b>BOOST_PP_ITERATE</b> macro initiates a <i>file-iteration</i>.
|
||||
</div>
|
||||
<h4>Usage</h4>
|
||||
<div class="code">
|
||||
#include <b>BOOST_PP_ITERATE</b>()
|
||||
</div>
|
||||
<h4>Remarks</h4>
|
||||
<div>
|
||||
Arguments to this macro are passed as <i>external named arguments</i> in one of two
|
||||
ways--either through <b>BOOST_PP_FILENAME_<i>x</i></b> and <b>BOOST_PP_ITERATION_LIMITS</b> <i>or</i>
|
||||
through <b>BOOST_PP_ITERATION_PARAMS_<i>x</i></b>.
|
||||
</div>
|
||||
<div>
|
||||
Three pieces of information are required to perform a <i>file-iteration</i>.
|
||||
First, the name of a file to iterate over.
|
||||
This is passed via <b>BOOST_PP_FILENAME_<i>x</i></b> <i>or</i> as part of <b>BOOST_PP_ITERATION_PARAMS_<i>x</i></b>.
|
||||
The <i>file-iteration</i> mechanism will repeatedly include this file with iteration values ranging from a lower bound to an upper bound--the second and third <i>required</i> parameters.
|
||||
These two boundaries are either passed through <b>BOOST_PP_ITERATION_LIMITS</b> <i>or</i> as part of <b>BOOST_PP_ITERATION_PARAMS_<i>x</i></b>.
|
||||
</div>
|
||||
<div>
|
||||
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 <b>BOOST_PP_ITERATION_PARAMS_<i>x</i></b>.
|
||||
</div>
|
||||
<div>
|
||||
While a <i>file-iteration</i> is in progress, <b>BOOST_PP_IS_ITERATING</b> is defined as <i>1</i>.
|
||||
</div>
|
||||
<h4>See Also</h4>
|
||||
<ul>
|
||||
<li><a href="filename_x.html">BOOST_PP_FILENAME_<i>x</i></a></li>
|
||||
<li><a href="is_iterating.html">BOOST_PP_IS_ITERATING</a></li>
|
||||
<li><a href="iteration_limits.html">BOOST_PP_ITERATION_LIMITS</a></li>
|
||||
<li><a href="iteration_params_x.html">BOOST_PP_ITERATION_PARAMS_<i>x</i></a></li>
|
||||
</ul>
|
||||
<h4>Requirements</h4>
|
||||
<div>
|
||||
<b>Header:</b> <a href="../headers/iteration/iterate.hpp.html"><boost/preprocessor/iteration/iterate.hpp></a>
|
||||
</div>
|
||||
<h4><a class="local" onclick="toggle('sample');" onmouseover="change(this);" onmouseout="revert(this);">Sample Code</a></h4>
|
||||
<div id="sample"><pre>
|
||||
// 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
|
||||
<pre></div>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user