mirror of
https://github.com/boostorg/preprocessor.git
synced 2025-07-21 16:22:55 +02:00
Added BOOST_PP_ENUM, BOOST_PP_ENUM_SHIFTED, BOOST_PP_FOR,
BOOST_PP_EXPAND [SVN r12368]
This commit is contained in:
@ -8,11 +8,15 @@ BOOST_PP_COMMA_IF
|
||||
BOOST_PP_DEC
|
||||
BOOST_PP_DIV
|
||||
BOOST_PP_EMPTY
|
||||
BOOST_PP_ENUM
|
||||
BOOST_PP_ENUM_PARAMS
|
||||
BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT
|
||||
BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS
|
||||
BOOST_PP_ENUM_SHIFTED
|
||||
BOOST_PP_ENUM_SHIFTED_PARAMS
|
||||
BOOST_PP_EQUAL
|
||||
BOOST_PP_EXPAND
|
||||
BOOST_PP_FOR
|
||||
BOOST_PP_GREATER
|
||||
BOOST_PP_GREATER_EQUAL
|
||||
BOOST_PP_IDENTITY
|
||||
|
@ -3,5 +3,6 @@ please e-mail such suggestions to boost@yahoogroups.com, but also cc
|
||||
them to vesa.karvonen@housemarque.fi.
|
||||
|
||||
Current R&D:
|
||||
- Faster arithmetic
|
||||
- Data structures (cons list)
|
||||
- Faster preprocessing
|
||||
- Faster arithmetic
|
||||
|
66
doc/reference/enum_8hpp.html
Normal file
66
doc/reference/enum_8hpp.html
Normal file
@ -0,0 +1,66 @@
|
||||
<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>enum.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="enum_8hpp.html#a0">BOOST_PP_ENUM</a>(N, F, P)</td></tr>
|
||||
<tr><td> </td><td><font size=-1><em>Generates a comma separated list.</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/enum.hpp">Click here to see the header.</a>
|
||||
<p>
|
||||
<hr><h2>Define Documentation</h2>
|
||||
<a name="a0" doxytag="enum.hpp::BOOST_PP_ENUM"></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_ENUM</td>
|
||||
<td class="md" valign="top">( </td>
|
||||
<td class="md" nowrap valign="top">N, <tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="md" nowrap>F, <tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="md" nowrap>P </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>
|
||||
Generates a comma separated list.
|
||||
<p>
|
||||
In other words, expands to the sequence:
|
||||
<p>
|
||||
<pre><div class="fragment"><pre>
|
||||
F(0,P), F(1,P), ..., F(N-1,P)
|
||||
</pre></div></pre>
|
||||
<p>
|
||||
NOTE: The implementation uses <a class="el" href="repeat_8hpp.html#a0">BOOST_PP_REPEAT</a>(). </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>
|
66
doc/reference/enum__shifted_8hpp.html
Normal file
66
doc/reference/enum__shifted_8hpp.html
Normal file
@ -0,0 +1,66 @@
|
||||
<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>enum_shifted.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="enum__shifted_8hpp.html#a0">BOOST_PP_ENUM_SHIFTED</a>(N, F, P)</td></tr>
|
||||
<tr><td> </td><td><font size=-1><em>Generates a comma separated shifted list.</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/enum_shifted.hpp">Click here to see the header.</a>
|
||||
<p>
|
||||
<hr><h2>Define Documentation</h2>
|
||||
<a name="a0" doxytag="enum_shifted.hpp::BOOST_PP_ENUM_SHIFTED"></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_ENUM_SHIFTED</td>
|
||||
<td class="md" valign="top">( </td>
|
||||
<td class="md" nowrap valign="top">N, <tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="md" nowrap>F, <tr>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td class="md" nowrap>P </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>
|
||||
Generates a comma separated shifted list.
|
||||
<p>
|
||||
In other words, expands to the sequence:
|
||||
<p>
|
||||
<pre><div class="fragment"><pre>
|
||||
F(1,P), F(2,P), ..., F(N-1,P)
|
||||
</pre></div></pre>
|
||||
<p>
|
||||
NOTE: The implementation uses <a class="el" href="repeat_8hpp.html#a0">BOOST_PP_REPEAT</a>(). </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>
|
54
doc/reference/expand_8hpp.html
Normal file
54
doc/reference/expand_8hpp.html
Normal file
@ -0,0 +1,54 @@
|
||||
<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>expand.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="expand_8hpp.html#a0">BOOST_PP_EXPAND</a>(X)</td></tr>
|
||||
<tr><td> </td><td><font size=-1><em>Essentially macro expands the parameter X twice.</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/expand.hpp">Click here to see the header.</a>
|
||||
<p>
|
||||
<hr><h2>Define Documentation</h2>
|
||||
<a name="a0" doxytag="expand.hpp::BOOST_PP_EXPAND"></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_EXPAND</td>
|
||||
<td class="md" valign="top">( </td>
|
||||
<td class="md" nowrap valign="top">X </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>
|
||||
Essentially macro expands the parameter X twice.
|
||||
<p>
|
||||
</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>
|
@ -21,11 +21,15 @@
|
||||
<tr bgcolor="#f0f0f0"><td><a class="el" href="eat_8hpp.html">eat.hpp</a></td><td></td></tr>
|
||||
<tr bgcolor="#f0f0f0"><td><a class="el" href="elem_8hpp.html">elem.hpp</a></td><td></td></tr>
|
||||
<tr bgcolor="#f0f0f0"><td><a class="el" href="empty_8hpp.html">empty.hpp</a></td><td></td></tr>
|
||||
<tr bgcolor="#f0f0f0"><td><a class="el" href="enum_8hpp.html">enum.hpp</a></td><td></td></tr>
|
||||
<tr bgcolor="#f0f0f0"><td><a class="el" href="enum__params_8hpp.html">enum_params.hpp</a></td><td></td></tr>
|
||||
<tr bgcolor="#f0f0f0"><td><a class="el" href="enum_params_with_a_default.htm">enum_params_with_a_default.hpp</a></td><td></td></tr>
|
||||
<tr bgcolor="#f0f0f0"><td><a class="el" href="enum_params_with_defaults.htm">enum_params_with_defaults.hpp</a></td><td></td></tr>
|
||||
<tr bgcolor="#f0f0f0"><td><a class="el" href="enum__shifted_8hpp.html">enum_shifted.hpp</a></td><td></td></tr>
|
||||
<tr bgcolor="#f0f0f0"><td><a class="el" href="enum__shifted__params_8hpp.html">enum_shifted_params.hpp</a></td><td></td></tr>
|
||||
<tr bgcolor="#f0f0f0"><td><a class="el" href="equal_8hpp.html">equal.hpp</a></td><td></td></tr>
|
||||
<tr bgcolor="#f0f0f0"><td><a class="el" href="expand_8hpp.html">expand.hpp</a></td><td></td></tr>
|
||||
<tr bgcolor="#f0f0f0"><td><a class="el" href="for_8hpp.html">for.hpp</a></td><td></td></tr>
|
||||
<tr bgcolor="#f0f0f0"><td><a class="el" href="greater_8hpp.html">greater.hpp</a></td><td></td></tr>
|
||||
<tr bgcolor="#f0f0f0"><td><a class="el" href="greater__equal_8hpp.html">greater_equal.hpp</a></td><td></td></tr>
|
||||
<tr bgcolor="#f0f0f0"><td><a class="el" href="identity_8hpp.html">identity.hpp</a></td><td></td></tr>
|
||||
|
82
doc/reference/for_8hpp.html
Normal file
82
doc/reference/for_8hpp.html
Normal file
@ -0,0 +1,82 @@
|
||||
<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/C++ preprocessor. </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>
|
@ -17,12 +17,16 @@
|
||||
: <a class="el" href="comma__if_8hpp.html#a0">comma_if.hpp</a><li>BOOST_PP_DEC
|
||||
: <a class="el" href="dec_8hpp.html#a0">dec.hpp</a><li>BOOST_PP_DIV
|
||||
: <a class="el" href="div_8hpp.html#a0">div.hpp</a><li>BOOST_PP_EMPTY
|
||||
: <a class="el" href="empty_8hpp.html#a0">empty.hpp</a><li>BOOST_PP_ENUM_PARAMS
|
||||
: <a class="el" href="empty_8hpp.html#a0">empty.hpp</a><li>BOOST_PP_ENUM
|
||||
: <a class="el" href="enum_8hpp.html#a0">enum.hpp</a><li>BOOST_PP_ENUM_PARAMS
|
||||
: <a class="el" href="enum__params_8hpp.html#a0">enum_params.hpp</a><li>BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT
|
||||
: <a class="el" href="enum_params_with_a_default.htm#a0">enum_params_with_a_default.hpp</a><li>BOOST_PP_ENUM_PARAMS_WITH_DEFAULTS
|
||||
: <a class="el" href="enum_params_with_defaults.htm#a0">enum_params_with_defaults.hpp</a><li>BOOST_PP_ENUM_SHIFTED_PARAMS
|
||||
: <a class="el" href="enum_params_with_defaults.htm#a0">enum_params_with_defaults.hpp</a><li>BOOST_PP_ENUM_SHIFTED
|
||||
: <a class="el" href="enum__shifted_8hpp.html#a0">enum_shifted.hpp</a><li>BOOST_PP_ENUM_SHIFTED_PARAMS
|
||||
: <a class="el" href="enum__shifted__params_8hpp.html#a0">enum_shifted_params.hpp</a><li>BOOST_PP_EQUAL
|
||||
: <a class="el" href="equal_8hpp.html#a0">equal.hpp</a><li>BOOST_PP_GREATER
|
||||
: <a class="el" href="equal_8hpp.html#a0">equal.hpp</a><li>BOOST_PP_EXPAND
|
||||
: <a class="el" href="expand_8hpp.html#a0">expand.hpp</a><li>BOOST_PP_FOR
|
||||
: <a class="el" href="for_8hpp.html#a0">for.hpp</a><li>BOOST_PP_GREATER
|
||||
: <a class="el" href="greater_8hpp.html#a0">greater.hpp</a><li>BOOST_PP_GREATER_EQUAL
|
||||
: <a class="el" href="greater__equal_8hpp.html#a0">greater_equal.hpp</a><li>BOOST_PP_IDENTITY
|
||||
: <a class="el" href="identity_8hpp.html#a0">identity.hpp</a><li>BOOST_PP_IF
|
||||
|
@ -54,9 +54,9 @@ Iterates F(D,X) while C(D,X) is true.
|
||||
<p>
|
||||
<b>C</b> is the condition for iteration. It must expand to a decimal integer literal.
|
||||
<p>
|
||||
<b>F</b> is the iterated function. Note that if the state is a tuple, then F(D,X) usually expands to a tuple of the same number of elements.
|
||||
<b>F</b> is the iterated macro. Note that if the state is a tuple, then F(D,X) usually expands to a tuple of the same number of elements.
|
||||
<p>
|
||||
<b>D</b> is the recursion depth and should only be used as a parameter to other functions implemented using <a class="el" href="while_8hpp.html#a0">BOOST_PP_WHILE</a>(). Such functions include <a class="el" href="add_8hpp.html#a0">BOOST_PP_ADD</a>() and other arithmetic operations. For each function implemented using <a class="el" href="while_8hpp.html#a0">BOOST_PP_WHILE</a>(), there is a version of the function, distinguished by the _D suffix (e.g. BOOST_PP_ADD_D()), 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/C++ preprocessor.
|
||||
<b>D</b> is the recursion depth and should only be used as a parameter to other macros implemented using <a class="el" href="while_8hpp.html#a0">BOOST_PP_WHILE</a>(). Such macros include <a class="el" href="add_8hpp.html#a0">BOOST_PP_ADD</a>() and other arithmetic operations. For each macro implemented using <a class="el" href="while_8hpp.html#a0">BOOST_PP_WHILE</a>(), there is a version of the macro, distinguished by the _D suffix (e.g. BOOST_PP_ADD_D()), 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/C++ preprocessor.
|
||||
<p>
|
||||
NOTE: The value of the D parameter may exceed BOOST_PP_LIMIT_MAG.
|
||||
<p>
|
||||
@ -69,13 +69,13 @@ Here is a trivial example that simply counts down from N to 0 ultimately expandi
|
||||
<p>
|
||||
<pre><div class="fragment"><pre>
|
||||
#define COUNT_DOWN(N) BOOST_PP_WHILE(COUNT_DOWN_C,COUNT_DOWN_F,N)
|
||||
// Above is the function we are implementing using BOOST_PP_WHILE().
|
||||
// Above is the macro we are implementing using BOOST_PP_WHILE().
|
||||
|
||||
#define COUNT_DOWN_C(D,N) N
|
||||
// Above is the Condition. It expands to the current N.
|
||||
// Above is the condition. It expands to the current N.
|
||||
|
||||
#define COUNT_DOWN_F(D,N) BOOST_PP_DEC(N)
|
||||
// Above is the iteration Function. It decrements N.
|
||||
// Above is the iteration macro. It decrements N.
|
||||
|
||||
COUNT_DOWN(50)
|
||||
// The above expands to 0.
|
||||
@ -85,7 +85,7 @@ For a more complex example, let's take a look at an implementation of <a class="
|
||||
<p>
|
||||
<pre><div class="fragment"><pre>
|
||||
#define BOOST_PP_MUL(X,Y) BOOST_PP_MUL_D(0,X,Y)
|
||||
// Since the function is implemented using WHILE, the actual implementation
|
||||
// Since the macro is implemented using WHILE, the actual implementation
|
||||
// takes a depth as a parameter so that it can be called inside a WHILE.
|
||||
// The above easy-to-use version simply uses 0 as the depth and can not be
|
||||
// called inside a WHILE.
|
||||
@ -101,7 +101,7 @@ For a more complex example, let's take a look at an implementation of <a class="
|
||||
// #2) The WHILE primitive is "invoked" directly. BOOST_PP_WHILE(D,...)
|
||||
// can't be used because it would not be expanded by the C preprocessor.
|
||||
//
|
||||
// #3) ???_C is the condition and ???_F is the iteration function.
|
||||
// #3) ???_C is the condition and ???_F is the iteration macro.
|
||||
|
||||
#define BOOST_PP_MUL_C(D,P)\
|
||||
BOOST_PP_TUPLE_ELEM(3,2,P)
|
||||
|
Reference in New Issue
Block a user