The BOOST_PP_LIST_FILTER macro filters a list according to a supplied criterion.

#### Usage

BOOST_PP_LIST_FILTER(pred, data, list)

#### Arguments

pred
  A ternary predicate of the form pred(d, data, elem). This predicate is expanded by BOOST_PP_LIST_FILTER for each element in list with the next available BOOST_PP_WHILE iteration, the auxiliary data, and the current element in list. This macro must return a integral value in the range of 0 to BOOST_PP_LIMIT_MAG. If this predicate expands to non-zero for a certain element, that element is included in the resulting list.
data
  Auxiliary data passed to pred.
list
  The list to be filtered.

#### Remarks

This macro expands pred for each element in list. It builds a new list out of each element for which pred returns non-zero.
Previously, this macro could not be used inside BOOST_PP_WHILE. There is no longer any such restriction. It is more efficient, however, to use BOOST_PP_LIST_FILTER_D in such a situation.

#### See Also

- BOOST_PP_LIMIT_MAG
- BOOST_PP_LIST_FILTER_D

#### Requirements

Header: <boost/preprocessor/list/filter.hpp>

#### Sample Code

    #include <boost/preprocessor/comparison/less_equal.hpp>
    #include <boost/preprocessor/list/filter.hpp>

    #define LIST (1, (3, (2, (5, BOOST_PP_NIL))))

    #define PRED(d, data, elem) BOOST_PP_LESS_EQUAL(elem, data)

    BOOST_PP_LIST_FILTER(PRED, 3, LIST) // expands to (1, (3, (2, BOOST_PP_NIL)))