The BOOST_PP_SET_FILTER macro filters a set according to a supplied criterion.

Usage

BOOST_PP_SET_FILTER(pred, data, set)

Arguments

pred
A ternary predicate of the form pred(s, data, elem).  This predicate is expanded by BOOST_PP_SET_FILTER for each element in set with the next available BOOST_PP_SET_FOLD_LEFT fold step, the auxiliary data, and the current element in set.  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 set.
data
Auxiliary data passed to pred.
set
The set to be filtered.

Remarks

This macro expands pred for each element in set.  It builds a new set out of each element for which pred returns non-zero.
For maximum efficiency, use BOOST_PP_SET_FILTER_S.

See Also

Requirements

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

Sample Code

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

#define SET (1)(3)(2)(5)

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

BOOST_PP_SET_FILTER(PRED, 3, SET)
   // expands to (1)(3)(2)