mirror of
https://github.com/boostorg/preprocessor.git
synced 2025-07-15 21:42:08 +02:00
92 lines
2.6 KiB
HTML
92 lines
2.6 KiB
HTML
![]() |
<html>
|
||
|
<head>
|
||
|
<title>BOOST_PP_RELATIVE_ITERATION</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_RELATIVE_ITERATION</b> macro expands to the iteration value of a <i>file-iteration</i> depth relative to the current depth.
|
||
|
</div>
|
||
|
<h4>Usage</h4>
|
||
|
<div class="code">
|
||
|
<b>BOOST_PP_RELATIVE_ITERATION</b>(<i>i</i>)
|
||
|
</div>
|
||
|
<h4>Arguments</h4>
|
||
|
<dl>
|
||
|
<dt>i</dt>
|
||
|
<dd>
|
||
|
The relative depth of the frame whose iteration value is to be retreived.
|
||
|
Valid values range from <i>0</i> to <b>BOOST_PP_ITERATION_DEPTH</b>() - <i>1</i>.
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<h4>Remarks</h4>
|
||
|
<div>
|
||
|
This macro is only valid when a <i>file-iteration</i> is in progress.
|
||
|
</div>
|
||
|
<div>
|
||
|
The argument <i>i</i> is interpreted as the number of frames <i>outward</i> from the current frame.
|
||
|
Therefore, <b>BOOST_PP_RELATIVE_ITERATION</b>(<i>0</i>) is equivalent to <b>BOOST_PP_ITERATION</b>().
|
||
|
</div>
|
||
|
<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>
|
||
|
|
||
|
1st iteration:
|
||
|
#define BOOST_PP_ITERATION_PARAMS_1 (4, (0, 3, "file.h", 0x0001))
|
||
|
#include BOOST_PP_ITERATE()
|
||
|
|
||
|
2nd iteration:
|
||
|
#define BOOST_PP_ITERATION_PARAMS_1 (4, (1, 10, "file.h", 0x0002))
|
||
|
#include BOOST_PP_ITERATE()
|
||
|
|
||
|
#endif
|
||
|
|
||
|
#elif BOOST_PP_ITERATION_DEPTH() == 1 /* ... */ \
|
||
|
&& BOOST_PP_ITERATION_FLAGS() == 0x0001 \
|
||
|
/**/
|
||
|
|
||
|
--
|
||
|
#define BOOST_PP_ITERATION_PARAMS_2 (3, (1, 10, "file.h"))
|
||
|
#include BOOST_PP_ITERATE()
|
||
|
|
||
|
#elif BOOST_PP_ITERATION_DEPTH() == 1 /* ... */ \
|
||
|
&& BOOST_PP_ITERATION_FLAGS() == 0x0002 \
|
||
|
/**/
|
||
|
|
||
|
--
|
||
|
#define BOOST_PP_ITERATION_PARAMS_2 /* ... */ \
|
||
|
(3, (1, BOOST_PP_ITERATION(), "file.h")) \
|
||
|
/**/
|
||
|
#include BOOST_PP_ITERATE()
|
||
|
|
||
|
#elif BOOST_PP_ITERATION_DEPTH() == 2 /* ... */ \
|
||
|
&& BOOST_PP_FRAME_FLAGS(1) == 0x0001 \
|
||
|
/**/
|
||
|
|
||
|
--
|
||
|
#define BOOST_PP_ITERATION_PARAMS_3 /* ... */ \
|
||
|
(3, (1, BOOST_PP_ITERATION(), "file.h")) \
|
||
|
/**/
|
||
|
#include BOOST_PP_ITERATE()
|
||
|
|
||
|
#else // used by both
|
||
|
|
||
|
previous: BOOST_PP_RELATIVE_ITERATION(1)
|
||
|
current: BOOST_PP_ITERATION()
|
||
|
|
||
|
#endif
|
||
|
<pre></div>
|
||
|
</body>
|
||
|
</html>
|