mirror of
https://github.com/boostorg/preprocessor.git
synced 2025-07-02 23:36:54 +02:00
93 lines
4.5 KiB
HTML
93 lines
4.5 KiB
HTML
<a href="../index.htm"><IMG height=86
|
||
alt="c++boost.gif (8819 bytes)"
|
||
src="../../../../c++boost.gif"
|
||
width=277 align=center></a>
|
||
<hr>
|
||
<!-- Generated by Doxygen 1.2.13 -->
|
||
<center>
|
||
<a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="globals.html">File Members</a> </center>
|
||
<hr><h1>for.hpp File Reference</h1><table border=0 cellpadding=0 cellspacing=0>
|
||
<tr><td colspan=2><br><h2>Defines</h2></td></tr>
|
||
<tr><td nowrap align=right valign=top>#define </td><td valign=bottom><a class="el" href="for_8hpp.html#a0">BOOST_PP_FOR</a>(X, C, F, I)</td></tr>
|
||
<tr><td> </td><td><font size=-1><em>Repeats I(R,X) and iterates F(R,X) while C(R,X) is true.</em> <a href="#a0">More...</a><em></em></font><br><br></td></tr>
|
||
</table>
|
||
<hr><a name="_details"></a><h2>Detailed Description</h2>
|
||
<a href="../../../../boost/preprocessor/for.hpp">Click here to see the header.</a>
|
||
<p>
|
||
<hr><h2>Define Documentation</h2>
|
||
<a name="a0" doxytag="for.hpp::BOOST_PP_FOR"></a><p>
|
||
<table width="100%" cellpadding="2" cellspacing="0" border="0">
|
||
<tr>
|
||
<td class="md">
|
||
<table cellpadding="0" cellspacing="0" border="0">
|
||
<tr>
|
||
<td class="md" nowrap valign="top"> #define BOOST_PP_FOR</td>
|
||
<td class="md" valign="top">( </td>
|
||
<td class="md" nowrap valign="top">X, <tr>
|
||
<td></td>
|
||
<td></td>
|
||
<td class="md" nowrap>C, <tr>
|
||
<td></td>
|
||
<td></td>
|
||
<td class="md" nowrap>F, <tr>
|
||
<td></td>
|
||
<td></td>
|
||
<td class="md" nowrap>I </td>
|
||
<td class="mdname1" valign="top" nowrap> </td>
|
||
<td class="md" valign="top">) </td>
|
||
<td class="md" nowrap>
|
||
</table>
|
||
</td>
|
||
</tr>
|
||
</table>
|
||
<table cellspacing=5 cellpadding=0 border=0>
|
||
<tr>
|
||
<td>
|
||
|
||
</td>
|
||
<td>
|
||
|
||
<p>
|
||
Repeats I(R,X) and iterates F(R,X) while C(R,X) is true.
|
||
<p>
|
||
In other words, expands to the sequence:
|
||
<p>
|
||
<pre><div class="fragment"><pre>
|
||
I(R,X) I(R,F(R,X)) I(R,F(R,F(R,X))) ... I(R,F(R,F(...F(R,X)...)))
|
||
</pre></div></pre>
|
||
<p>
|
||
The length of the sequence is determined by C(R,X).
|
||
<p>
|
||
<h3>Legend</h3>
|
||
|
||
<p>
|
||
<b>X</b> is the current state of iteration. The state is usually a tuple.
|
||
<p>
|
||
<b>C</b> is the condition for iteration. It must expand to a decimal integer literal.
|
||
<p>
|
||
<b>F</b> is the iterated macro. Note that if the state is a tuple, then F(R,X) usually expands to a tuple of the same number of elements.
|
||
<p>
|
||
<b>I</b> is the state instantiation macro.
|
||
<p>
|
||
<b>R</b> is the recursion depth and should only be used as a parameter to other macros implemented using <a class="el" href="for_8hpp.html#a0">BOOST_PP_FOR</a>() or for invoking BOOST_PP_FOR#R() directly. For each macro implemented using <a class="el" href="for_8hpp.html#a0">BOOST_PP_FOR</a>(), there is a version of the macro, distinguished by the _R suffix, that accepts an additional recursion depth as the first parameter. This technique is necessary to avoid recursively expanding the same macro again, which is not permitted by the C++ preprocessor.
|
||
<p>
|
||
<h3><a class="el" href="repeat_8hpp.html#a0">BOOST_PP_REPEAT</a>() vs <a class="el" href="for_8hpp.html#a0">BOOST_PP_FOR</a>()</h3>
|
||
|
||
<p>
|
||
<a class="el" href="for_8hpp.html#a0">BOOST_PP_FOR</a>() is a generalization of <a class="el" href="repeat_8hpp.html#a0">BOOST_PP_REPEAT</a>(). This means that <a class="el" href="repeat_8hpp.html#a0">BOOST_PP_REPEAT</a>() can be implemented using <a class="el" href="for_8hpp.html#a0">BOOST_PP_FOR</a>(). Unfortunately, <a class="el" href="for_8hpp.html#a0">BOOST_PP_FOR</a>() is slower than <a class="el" href="repeat_8hpp.html#a0">BOOST_PP_REPEAT</a>(). In addition, <a class="el" href="repeat_8hpp.html#a0">BOOST_PP_REPEAT</a>() was introduced earlier, is generally easier to use, and is still quite useful on its own.
|
||
<p>
|
||
<h3>2D and 3D repetition</h3>
|
||
|
||
<p>
|
||
<a class="el" href="for_8hpp.html#a0">BOOST_PP_FOR</a>() can be used for multidimensional repetition simply by invoking BOOST_PP_FOR#R() directly. </td>
|
||
</tr>
|
||
</table>
|
||
<hr>
|
||
<p><EFBFBD> Copyright Housemarque Oy 2001</p>
|
||
<p>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. </p>
|
||
|
||
<p>Generated: <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan --><!--webbot bot="Timestamp" endspan i-checksum="15246" --></p>
|