]> git.lyx.org Git - lyx.git/blob - boost/boost/preprocessor/list/filter.hpp
update boost to version 1.29.0
[lyx.git] / boost / boost / preprocessor / list / filter.hpp
1 # /* Copyright (C) 2001
2 #  * Housemarque Oy
3 #  * http://www.housemarque.com
4 #  *
5 #  * Permission to copy, use, modify, sell and distribute this software is
6 #  * granted provided this copyright notice appears in all copies. This
7 #  * software is provided "as is" without express or implied warranty, and
8 #  * with no claim as to its suitability for any purpose.
9 #  */
10 #
11 # /* Revised by Paul Mensonides (2002) */
12 #
13 # /* See http://www.boost.org for most recent version. */
14 #
15 # ifndef BOOST_PREPROCESSOR_LIST_FILTER_HPP
16 # define BOOST_PREPROCESSOR_LIST_FILTER_HPP
17 #
18 # include <boost/preprocessor/config/config.hpp>
19 # include <boost/preprocessor/control/if.hpp>
20 # include <boost/preprocessor/list/fold_right.hpp>
21 # include <boost/preprocessor/tuple/elem.hpp>
22 # include <boost/preprocessor/tuple/rem.hpp>
23 #
24 # /* BOOST_PP_LIST_FILTER */
25 #
26 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
27 #    define BOOST_PP_LIST_FILTER(pred, data, list) BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_LIST_FOLD_RIGHT(BOOST_PP_LIST_FILTER_O, (pred, data, BOOST_PP_NIL), list))
28 # else
29 #    define BOOST_PP_LIST_FILTER(pred, data, list) BOOST_PP_LIST_FILTER_I(pred, data, list)
30 #    define BOOST_PP_LIST_FILTER_I(pred, data, list) BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_LIST_FOLD_RIGHT(BOOST_PP_LIST_FILTER_O, (pred, data, BOOST_PP_NIL), list))
31 # endif
32 #
33 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
34 #    define BOOST_PP_LIST_FILTER_O(d, pdr, elem) BOOST_PP_LIST_FILTER_O_D(d, BOOST_PP_TUPLE_ELEM(3, 0, pdr), BOOST_PP_TUPLE_ELEM(3, 1, pdr), BOOST_PP_TUPLE_ELEM(3, 2, pdr), elem)
35 # else
36 #    define BOOST_PP_LIST_FILTER_O(d, pdr, elem) BOOST_PP_LIST_FILTER_O_I(d, BOOST_PP_TUPLE_REM_3 pdr, elem)
37 #    define BOOST_PP_LIST_FILTER_O_I(d, im, elem) BOOST_PP_LIST_FILTER_O_D(d, im, elem)
38 # endif
39 #
40 # define BOOST_PP_LIST_FILTER_O_D(d, pred, data, res, elem) (pred, data, BOOST_PP_IF(pred(d, data, elem), (elem, res), res))
41 #
42 # /* BOOST_PP_LIST_FILTER_D */
43 #
44 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
45 #    define BOOST_PP_LIST_FILTER_D(d, pred, data, list) BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_LIST_FOLD_RIGHT_ ## d(BOOST_PP_LIST_FILTER_O, (pred, data, BOOST_PP_NIL), list))
46 # else
47 #    define BOOST_PP_LIST_FILTER_D(d, pred, data, list) BOOST_PP_LIST_FILTER_D_I(d, pred, data, list)
48 #    define BOOST_PP_LIST_FILTER_D_I(d, pred, data, list) BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_LIST_FOLD_RIGHT_ ## d(BOOST_PP_LIST_FILTER_O, (pred, data, BOOST_PP_NIL), list))
49 # endif
50 #
51 # endif