1<html> 2 <head> 3 <title>BOOST_PP_SEQ_FILTER</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_FILTER</b> macro filters a <i>seq</i> according to a 9 supplied criterion. 10 </div> 11 <h4> 12 Usage 13 </h4> 14 <div class="code"> 15 <b>BOOST_PP_SEQ_FILTER</b>(<i>pred</i>, <i>data</i>, <i>seq</i>) 16 </div> 17 <h4> 18 Arguments 19 </h4> 20 <dl> 21 <dt>pred</dt> 22 <dd> 23 A ternary predicate of the form <i>pred</i>(<i>s</i>, <i>data</i>, <i>elem</i>). 24 This predicate is expanded by <b>BOOST_PP_SEQ_FILTER</b> for each element in <i>seq</i> 25 with the next available <b>BOOST_PP_SEQ_FOLD_LEFT</b> fold step, the auxiliary <i>data</i>, 26 and the current element in <i>seq</i>. This macro must return a integral 27 value in the range of <i>0</i> to <b>BOOST_PP_LIMIT_MAG</b>. If this 28 predicate expands to non-zero for a certain element, that element is included 29 in the resulting <i>seq</i>. 30 </dd> 31 <dt>data</dt> 32 <dd> 33 Auxiliary data passed to <i>pred</i>. 34 </dd> 35 <dt>seq</dt> 36 <dd> 37 The <i>seq</i> to be filtered. 38 </dd> 39 </dl> 40 <h4> 41 Remarks 42 </h4> 43 <div> 44 This macro expands <i>pred</i> for each element in <i>seq</i>. It builds 45 a new <i>seq</i> out of each element for which <i>pred</i> returns non-zero. 46 </div> 47 <div> 48 For maximum efficiency, use <b>BOOST_PP_SEQ_FILTER_S</b>. 49 </div> 50 <h4> 51 See Also 52 </h4> 53 <ul> 54 <li> 55 <a href="limit_mag.html">BOOST_PP_LIMIT_MAG</a></li> 56 <li> 57 <a href="seq_filter_s.html">BOOST_PP_SEQ_FILTER_S</a></li> 58 </ul> 59 <h4> 60 Requirements 61 </h4> 62 <div> 63 <b>Header:</b> <a href="../headers/seq/filter.html"><boost/preprocessor/seq/filter.hpp></a> 64 </div> 65 <h4> 66 Sample Code 67 </h4> 68 <div> 69 <pre> 70#include <<a href="../headers/comparison/less_equal.html">boost/preprocessor/comparison/less_equal.hpp</a>> 71#include <<a href="../headers/seq/filter.html">boost/preprocessor/seq/filter.hpp</a>> 72 73#define SEQ (1)(3)(2)(5) 74 75#define PRED(s, data, elem) <a href="less_equal.html">BOOST_PP_LESS_EQUAL</a>(elem, data) 76 77<a href="seq_filter.html">BOOST_PP_SEQ_FILTER</a>(PRED, 3, SEQ) 78 // expands to (1)(3)(2) 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