• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3	<title>BOOST_PP_REPEAT_FROM_TO_z</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_REPEAT_FROM_TO_<i>z</i></b> macro represents a reentry into the <b>BOOST_PP_REPEAT_FROM_TO</b> repetition construct.
9	</div>
10	<h4>Usage</h4>
11		<div class="code">
12			<b>BOOST_PP_REPEAT_FROM_TO_</b> ## <i>z</i>(<i>first</i>, <i>last</i>, <i>macro</i>, <i>data</i>)
13		</div>
14	<h4>Arguments</h4>
15		<dl>
16			<dt>z</dt>
17			<dd>
18				The next available <b>BOOST_PP_REPEAT</b> dimension.
19			</dd>
20			<dt>first</dt>
21			<dd>
22				The lower bound of the repetition.&nbsp;
23				Valid values range from <i>0</i> to <b>BOOST_PP_LIMIT_MAG</b>.
24			</dd>
25			<dt>last</dt>
26			<dd>
27				The upper bound of the repetition.
28				Valid values range from <i>0</i> to <b>BOOST_PP_LIMIT_MAG</b>.
29			</dd>
30			<dt>macro</dt>
31			<dd>
32				A ternary operation of the form <i>macro</i>(<i>z</i>, <i>n</i>, <i>data</i>).&nbsp;
33				This macro is expanded by <b>BOOST_PP_REPEAT</b> with the next available repetition depth,
34				the current repetition number, and the auxiliary <i>data</i> argument.&nbsp;
35			</dd>
36			<dt>data</dt>
37			<dd>
38				Auxiliary data passed to <i>macro</i>.
39			</dd>
40		</dl>
41	<h4>Remarks</h4>
42		<div>
43			This macro expands to the sequence:
44			<div>
45				<i>macro</i>(<i>z</i>, <i>first</i>, <i>data</i>) <i>macro</i>(<i>z</i>, <i>first</i> + <i>1</i>, <i>data</i>) ... <i>macro</i>(<i>z</i>, <i>last</i> - <i>1</i>, <i>data</i>)
46			</div>
47		</div>
48		<div>
49			The number of repetitions (i.e. <i>last</i> - <i>first</i>) must not exceed <b>BOOST_PP_LIMIT_REPEAT</b>.
50		</div>
51		<div>
52			At certain times, it may be necessary to perform the concatenation with <b>BOOST_PP_CAT</b> rather than the preprocessor token-pasting operator.&nbsp;
53			This happens when the <i>z</i> value is a macro invocation itself.&nbsp;
54			It needs a delay to allow it to expand.&nbsp;
55			The syntax in such a scenario becomes:
56			<div>
57				<b>BOOST_PP_CAT</b>(<b>BOOST_PP_REPEAT_FROM_TO_</b>, <i>z</i>)(<i>count</i>, <i>macro</i>, <i>data</i>).
58			</div>
59		</div>
60	<h4>See Also</h4>
61		<ul>
62			<li><a href="cat.html">BOOST_PP_CAT</a></li>
63			<li><a href="limit_repeat.html">BOOST_PP_LIMIT_REPEAT</a></li>
64			<li><a href="repeat.html">BOOST_PP_REPEAT</a></li>
65		</ul>
66	<h4>Requirements</h4>
67		<div>
68			<b>Header:</b> &nbsp;<a href="../headers/repetition/repeat_from_to.html">&lt;boost/preprocessor/repetition/repeat_from_to.hpp&gt;</a>
69		</div>
70	<h4>Sample Code</h4>
71<div><pre>
72#include &lt;<a href="../headers/repetition/repeat_from_to.html">boost/preprocessor/repetition/repeat_from_to.hpp</a>&gt;
73
74#define TEXT(z, n, data) n data
75
76#define MACRO(z, n, data) \
77  ( \
78     <a href="repeat_from_to_z.html">BOOST_PP_REPEAT_FROM_TO_</a> ## z( \
79        1, 4, \
80        TEXT, xyz \
81     ) \
82  ) \
83  /**/
84
85<a href="repeat.html">BOOST_PP_REPEAT</a>(3, MACRO, _)
86   /*
87      expands to:
88      (1 xyz 2 xyz 3 xyz)
89      (1 xyz 2 xyz 3 xyz)
90      (1 xyz 2 xyz 3 xyz)
91   */
92</pre></div>
93	<hr size="1">
94	<div style="margin-left: 0px;">
95		<i>� Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i>
96		</br><i>� Copyright Paul Mensonides 2002</i>
97	</div>
98	<div style="margin-left: 0px;">
99		<p><small>Distributed under the Boost Software License, Version 1.0. (See
100		accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
101		copy at <a href=
102		"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
103	</div>
104</body>
105</html>
106