3 <title>BOOST_PP_LIST_FILTER
</title>
4 <link rel=
"stylesheet" type=
"text/css" href=
"../styles.css">
7 <div style=
"margin-left: 0px;">
8 The
<b>BOOST_PP_LIST_FILTER
</b> macro filters a
<i>list
</i> according to a supplied criterion.
12 <b>BOOST_PP_LIST_FILTER
</b>(
<i>pred
</i>,
<i>data
</i>,
<i>list
</i>)
18 A ternary predicate of the form
<i>pred
</i>(
<i>d
</i>,
<i>data
</i>,
<i>elem
</i>).
19 This predicate is expanded by
<b>BOOST_PP_LIST_FILTER
</b> for each element in
<i>list
</i> with the next available
<b>BOOST_PP_WHILE
</b> iteration,
20 the auxiliary
<i>data
</i>, and the current element in
<i>list
</i>.
21 This macro must return a integral value in the range of
<i>0</i> to
<b>BOOST_PP_LIMIT_MAG
</b>.
22 If this predicate expands to non-zero for a certain element, that element is included in the resulting
<i>list
</i>.
26 Auxiliary data passed to
<i>pred
</i>.
30 The
<i>list
</i> to be filtered.
35 This macro expands
<i>pred
</i> for each element in
<i>list
</i>.
36 It builds a new
<i>list
</i> out of each element for which
<i>pred
</i> returns non-zero.
39 Previously, this macro could not be used inside
<b>BOOST_PP_WHILE
</b>.
40 There is no longer any such restriction.
41 It is more efficient, however, to use
<b>BOOST_PP_LIST_FILTER_D
</b> in such a situation.
45 <li><a href=
"limit_mag.html">BOOST_PP_LIMIT_MAG
</a></li>
46 <li><a href=
"list_filter_d.html">BOOST_PP_LIST_FILTER_D
</a></li>
50 <b>Header:
</b> <a href=
"../headers/list/filter.html"><boost/preprocessor/list/filter.hpp
></a>
54 #include
<<a href=
"../headers/comparison/less_equal.html">boost/preprocessor/comparison/less_equal.hpp
</a>>
55 #include
<<a href=
"../headers/list/filter.html">boost/preprocessor/list/filter.hpp
</a>>
57 #define LIST (
1, (
3, (
2, (
5,
<a href=
"nil.html">BOOST_PP_NIL
</a>))))
59 #define PRED(d, data, elem)
<a href=
"less_equal.html">BOOST_PP_LESS_EQUAL
</a>(elem, data)
61 <a href=
"list_filter.html">BOOST_PP_LIST_FILTER
</a>(PRED,
3, LIST)
62 // expands to (
1, (
3, (
2,
<a href=
"nil.html">BOOST_PP_NIL
</a>)))
65 <div style=
"margin-left: 0px;">
66 <i>© Copyright
<a href=
"http://www.housemarque.com" target=
"_top">Housemarque Oy
</a> 2002</i>
67 </br><i>© Copyright Paul Mensonides
2002</i>
69 <div style=
"margin-left: 0px;">
70 <p><small>Distributed under the Boost Software License, Version
1.0. (See
71 accompanying file
<a href=
"../../../../LICENSE_1_0.txt">LICENSE_1_0.txt
</a> or
73 "http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt
</a>)
</small></p>