Files
preprocessor/doc/ref/seq_transform.html

83 lines
2.2 KiB
HTML
Raw Normal View History

2002-10-13 05:47:23 +00:00
<html>
2002-11-07 23:39:29 +00:00
<head>
<title>BOOST_PP_SEQ_TRANSFORM</title>
<link rel="stylesheet" type="text/css" href="../styles.css">
</head>
<body>
<div style="margin-left: 0px;">
The <b>BOOST_PP_SEQ_TRANSFORM</b> macro transforms each element in a <i>seq</i>
according to a supplied transformation.
</div>
<h4>
Usage
</h4>
2002-10-13 05:47:23 +00:00
<div class="code">
2002-11-07 23:39:29 +00:00
<b>BOOST_PP_SEQ_TRANSFORM</b>(<i>op</i>, <i>data</i>, <i>seq</i>)
2002-10-13 05:47:23 +00:00
</div>
2002-11-07 23:39:29 +00:00
<h4>
Arguments
</h4>
2002-10-13 05:47:23 +00:00
<dl>
<dt>op</dt>
<dd>
2002-11-07 23:39:29 +00:00
A ternary predicate of the form <i>op</i>(<i>s</i>, <i>data</i>, <i>elem</i>).&nbsp;
This transformation is expanded by <b>BOOST_PP_SEQ_TRANSFORM</b> for each
element in <i>seq</i> with the next available <b>BOOST_PP_SEQ_FOLD_LEFT</b> fold
step, the auxiliary <i>data</i>, and the current element in <i>seq</i>.&nbsp;
2002-10-13 05:47:23 +00:00
</dd>
<dt>data</dt>
<dd>
Auxiliary data passed to <i>pred</i>.
</dd>
2002-11-07 23:39:29 +00:00
<dt>seq</dt>
2002-10-13 05:47:23 +00:00
<dd>
2002-11-07 23:39:29 +00:00
The <i>seq</i> to be transformed.
2002-10-13 05:47:23 +00:00
</dd>
</dl>
2002-11-07 23:39:29 +00:00
<h4>
Remarks
</h4>
2002-10-13 05:47:23 +00:00
<div>
2002-11-07 23:39:29 +00:00
This macro expands <i>op</i> for each element in <i>seq</i>.&nbsp; It builds a
new <i>seq</i> out of the results of each call.&nbsp; If, for example, <i>seq</i>
is (<i>a</i>)(<i>b</i>)(<i>c</i>), this macro expands to...
2002-10-13 05:47:23 +00:00
<div>
2002-11-07 23:39:29 +00:00
(<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>,
<i>data</i>, <i>c</i>))
2002-10-13 05:47:23 +00:00
</div>
</div>
<div>
2002-11-07 23:39:29 +00:00
For maximum efficiency, use <b>BOOST_PP_SEQ_TRANSFORM_S</b>.
2002-10-13 05:47:23 +00:00
</div>
2002-11-07 23:39:29 +00:00
<h4>
See Also
</h4>
2002-10-13 05:47:23 +00:00
<ul>
2002-11-07 23:39:29 +00:00
<li>
<a href="seq_transform_s.html">BOOST_PP_SEQ_TRANSFORM_S</a></li>
2002-10-13 05:47:23 +00:00
</ul>
2002-11-07 23:39:29 +00:00
<h4>
Requirements
</h4>
2002-10-13 05:47:23 +00:00
<div>
<b>Header:</b> &nbsp;<a href="../headers/seq/transform.html">&lt;boost/preprocessor/seq/transform.hpp&gt;</a>
2002-10-13 05:47:23 +00:00
</div>
2002-11-07 23:39:29 +00:00
<h4>
Sample Code
</h4>
<div>
<pre>
#include &lt;<a href="../headers/arithmetic/dec.html">boost/preprocessor/arithmetic/dec.hpp</a>&gt;
#include &lt;<a href="../headers/seq/transform.html">boost/preprocessor/seq/transform.hpp</a>&gt;
2002-10-13 05:47:23 +00:00
2002-11-07 23:39:29 +00:00
#define SEQ (1)(3)(2)(5)
2002-10-13 05:47:23 +00:00
#define OP(s, data, elem) <a href="dec.html">BOOST_PP_DEC</a>(elem)
2002-11-07 23:39:29 +00:00
<a href="seq_transform.html">BOOST_PP_SEQ_TRANSFORM</a>(OP, 3, SEQ)
2002-10-13 05:47:23 +00:00
// expands to (0)(2)(1)(4)
2002-11-07 23:39:29 +00:00
</pre>
</div>
</body>
2002-10-13 05:47:23 +00:00
</html>