• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2	<head>
3		<title>BOOST_PP_SEQ_TRANSFORM</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_SEQ_TRANSFORM</b> macro transforms each element in a <i>seq</i>
9			according to a supplied transformation.
10		</div>
11		<h4>
12			Usage
13		</h4>
14		<div class="code">
15			<b>BOOST_PP_SEQ_TRANSFORM</b>(<i>op</i>, <i>data</i>, <i>seq</i>)
16		</div>
17		<h4>
18			Arguments
19		</h4>
20		<dl>
21			<dt>op</dt>
22			<dd>
23				A ternary predicate of the form <i>op</i>(<i>s</i>, <i>data</i>, <i>elem</i>).&nbsp;
24				This transformation is expanded by <b>BOOST_PP_SEQ_TRANSFORM</b> for each
25				element in <i>seq</i> with the next available <b>BOOST_PP_SEQ_FOLD_LEFT</b> fold
26				step, the auxiliary <i>data</i>, and the current element in <i>seq</i>.&nbsp;
27			</dd>
28			<dt>data</dt>
29			<dd>
30				Auxiliary data passed to <i>pred</i>.
31			</dd>
32			<dt>seq</dt>
33			<dd>
34				The <i>seq</i> to be transformed.
35			</dd>
36		</dl>
37		<h4>
38			Remarks
39		</h4>
40		<div>
41			This macro expands <i>op</i> for each element in <i>seq</i>.&nbsp; It builds a
42			new <i>seq</i> out of the results of each call.&nbsp; If, for example, <i>seq</i>
43			is (<i>a</i>)(<i>b</i>)(<i>c</i>), this macro expands to...
44			<div>
45				(<i>op</i>(<i>d</i>, <i>data</i>, <i>a</i>))(<i>op</i>(<i>d</i>, <i>data</i>, <i>b</i>))(<i>op</i>(<i>d</i>,
46				<i>data</i>, <i>c</i>))
47			</div>
48		</div>
49		<div>
50			For maximum efficiency, use <b>BOOST_PP_SEQ_TRANSFORM_S</b>.
51		</div>
52		<h4>
53			See Also
54		</h4>
55		<ul>
56			<li>
57				<a href="seq_transform_s.html">BOOST_PP_SEQ_TRANSFORM_S</a></li>
58		</ul>
59		<h4>
60			Requirements
61		</h4>
62		<div>
63			<b>Header:</b> &nbsp;<a href="../headers/seq/transform.html">&lt;boost/preprocessor/seq/transform.hpp&gt;</a>
64		</div>
65		<h4>
66			Sample Code
67		</h4>
68		<div>
69			<pre>
70#include &lt;<a href="../headers/arithmetic/dec.html">boost/preprocessor/arithmetic/dec.hpp</a>&gt;
71#include &lt;<a href="../headers/seq/transform.html">boost/preprocessor/seq/transform.hpp</a>&gt;
72
73#define SEQ (1)(3)(2)(5)
74
75#define OP(s, data, elem) <a href="dec.html">BOOST_PP_DEC</a>(elem)
76
77<a href="seq_transform.html">BOOST_PP_SEQ_TRANSFORM</a>(OP, 3, SEQ)
78   // expands to (0)(2)(1)(4)
79</pre>
80		</div>
81	<hr size="1">
82	<div style="margin-left: 0px;">
83		<i>� Copyright <a href="http://www.housemarque.com" target="_top">Housemarque Oy</a> 2002</i>
84		</br><i>� Copyright Paul Mensonides 2002</i>
85	</div>
86	<div style="margin-left: 0px;">
87		<p><small>Distributed under the Boost Software License, Version 1.0. (See
88		accompanying file <a href="../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or
89		copy at <a href=
90		"http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</a>)</small></p>
91	</div>
92	</body>
93</html>
94