• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3	<title>BOOST_PP_RELATIVE_ITERATION</title>
4	<link rel="stylesheet" type="text/css" href="../styles.css">
5</head>
6<body>
7	<div style="margin-left:  0px;">
8		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.
9	</div>
10	<h4>Usage</h4>
11		<div class="code">
12			<b>BOOST_PP_RELATIVE_ITERATION</b>(<i>i</i>)
13		</div>
14	<h4>Arguments</h4>
15		<dl>
16			<dt>i</dt>
17			<dd>
18				The relative depth of the frame whose iteration value is to be retreived.&nbsp;
19				Valid values range from <i>0</i> to <b>BOOST_PP_ITERATION_DEPTH</b>() - <i>1</i>.
20			</dd>
21		</dl>
22	<h4>Remarks</h4>
23		<div>
24			This macro is only valid when a <i>file-iteration</i> is in progress.
25		</div>
26		<div>
27			The argument <i>i</i> is interpreted as the number of frames <i>outward</i> from the current frame.&nbsp;
28			Therefore, <b>BOOST_PP_RELATIVE_ITERATION</b>(<i>0</i>) is equivalent to <b>BOOST_PP_ITERATION</b>().
29		</div>
30	<h4>Requirements</h4>
31		<div>
32			<b>Header:</b> &nbsp;<a href="../headers/iteration/iterate.html">&lt;boost/preprocessor/iteration/iterate.hpp&gt;</a>
33		</div>
34	<h4>Sample Code</h4>
35<div><pre>
36// file.h
37#if !<a href="is_iterating.html">BOOST_PP_IS_ITERATING</a>
38
39   #ifndef FILE_H_
40   #define FILE_H_
41
42   #include &lt;<a href="../headers/iteration/iterate.html">boost/preprocessor/iteration/iterate.hpp</a>&gt;
43
441st iteration:
45   #define <a href="iteration_params_x.html">BOOST_PP_ITERATION_PARAMS_1</a> (4, (0, 3, "file.h", 0x0001))
46   #include <a href="iterate.html">BOOST_PP_ITERATE</a>()
47
482nd iteration:
49   #define <a href="iteration_params_x.html">BOOST_PP_ITERATION_PARAMS_1</a> (4, (1, 10, "file.h", 0x0002))
50   #include <a href="iterate.html">BOOST_PP_ITERATE</a>()
51
52   #endif
53
54#elif <a href="iteration_depth.html">BOOST_PP_ITERATION_DEPTH</a>() == 1 \
55   &amp;&amp; <a href="iteration_flags.html">BOOST_PP_ITERATION_FLAGS</a>() == 0x0001 \
56   /**/
57
58   --
59   #define <a href="iteration_params_x.html">BOOST_PP_ITERATION_PARAMS_2</a> (3, (1, 10, "file.h"))
60   #include <a href="iterate.html">BOOST_PP_ITERATE</a>()
61
62#elif <a href="iteration_depth.html">BOOST_PP_ITERATION_DEPTH</a>() == 1 \
63   &amp;&amp; <a href="iteration_flags.html">BOOST_PP_ITERATION_FLAGS</a>() == 0x0002 \
64   /**/
65
66   --
67   #define <a href="iteration_params_x.html">BOOST_PP_ITERATION_PARAMS_2</a> \
68      (3, (1, <a href="iteration.html">BOOST_PP_ITERATION</a>(), "file.h")) \
69      /**/
70   #include <a href="iterate.html">BOOST_PP_ITERATE</a>()
71
72#elif <a href="iteration_depth.html">BOOST_PP_ITERATION_DEPTH</a>() == 2 \
73   &amp;&amp; <a href="frame_flags.html">BOOST_PP_FRAME_FLAGS</a>(1) == 0x0001 \
74   /**/
75
76   --
77   #define <a href="iteration_params_x.html">BOOST_PP_ITERATION_PARAMS_3</a> \
78      (3, (1, <a href="iteration.html">BOOST_PP_ITERATION</a>(), "file.h")) \
79      /**/
80   #include <a href="iterate.html">BOOST_PP_ITERATE</a>()
81
82#else // used by both
83
84   previous: <a href="relative_iteration.html">BOOST_PP_RELATIVE_ITERATION</a>(1)
85   current: <a href="iteration.html">BOOST_PP_ITERATION</a>()
86
87#endif
88</pre></div>
89	<hr size="1">
90	<div style="margin-left: 0px;">
91		<i>� Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i>
92		</br><i>� Copyright Paul Mensonides 2002</i>
93	</div>
94	<div style="margin-left: 0px;">
95		<p><small>Distributed under the Boost Software License, Version 1.0. (See
96		accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
97		copy at <a href=
98		"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
99	</div>
100</body>
101</html>
102