]> git.lyx.org Git - lyx.git/blob - boost/boost/preprocessor/list/first_n.hpp
update boost to pre-1.30.0
[lyx.git] / boost / boost / preprocessor / list / first_n.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_FIRST_N_HPP
16 # define BOOST_PREPROCESSOR_LIST_FIRST_N_HPP
17 #
18 # include <boost/preprocessor/arithmetic/dec.hpp>
19 # include <boost/preprocessor/config/config.hpp>
20 # include <boost/preprocessor/control/while.hpp>
21 # include <boost/preprocessor/list/adt.hpp>
22 # include <boost/preprocessor/list/reverse.hpp>
23 # include <boost/preprocessor/tuple/elem.hpp>
24 # include <boost/preprocessor/tuple/rem.hpp>
25 #
26 # /* BOOST_PP_LIST_FIRST_N */
27 #
28 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
29 #    define BOOST_PP_LIST_FIRST_N(count, list) BOOST_PP_LIST_REVERSE(BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_WHILE(BOOST_PP_LIST_FIRST_N_P, BOOST_PP_LIST_FIRST_N_O, (count, list, BOOST_PP_NIL))))
30 # else
31 #    define BOOST_PP_LIST_FIRST_N(count, list) BOOST_PP_LIST_FIRST_N_I(count, list)
32 #    define BOOST_PP_LIST_FIRST_N_I(count, list) BOOST_PP_LIST_REVERSE(BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_WHILE(BOOST_PP_LIST_FIRST_N_P, BOOST_PP_LIST_FIRST_N_O, (count, list, BOOST_PP_NIL))))
33 # endif
34 #
35 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
36 #    define BOOST_PP_LIST_FIRST_N_P(d, data) BOOST_PP_TUPLE_ELEM(3, 0, data)
37 # else
38 #    define BOOST_PP_LIST_FIRST_N_P(d, data) BOOST_PP_LIST_FIRST_N_P_I data
39 #    define BOOST_PP_LIST_FIRST_N_P_I(c, l, nl) c
40 # endif
41 #
42 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
43 #    define BOOST_PP_LIST_FIRST_N_O(d, data) BOOST_PP_LIST_FIRST_N_O_D data
44 # else
45 #    define BOOST_PP_LIST_FIRST_N_O(d, data) BOOST_PP_LIST_FIRST_N_O_D(BOOST_PP_TUPLE_ELEM(3, 0, data), BOOST_PP_TUPLE_ELEM(3, 1, data), BOOST_PP_TUPLE_ELEM(3, 2, data))
46 # endif
47 #
48 # define BOOST_PP_LIST_FIRST_N_O_D(c, l, nl) (BOOST_PP_DEC(c), BOOST_PP_LIST_REST(l), (BOOST_PP_LIST_FIRST(l), nl))
49 #
50 # /* BOOST_PP_LIST_FIRST_N_D */
51 #
52 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
53 #    define BOOST_PP_LIST_FIRST_N_D(d, count, list) BOOST_PP_LIST_REVERSE_D(d, BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_WHILE_ ## d(BOOST_PP_LIST_FIRST_N_P, BOOST_PP_LIST_FIRST_N_O, (count, list, BOOST_PP_NIL))))
54 # else
55 #    define BOOST_PP_LIST_FIRST_N_D(d, count, list) BOOST_PP_LIST_FIRST_N_D_I(d, count, list)
56 #    define BOOST_PP_LIST_FIRST_N_D_I(d, count, list) BOOST_PP_LIST_REVERSE_D(d, BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_WHILE_ ## d(BOOST_PP_LIST_FIRST_N_P, BOOST_PP_LIST_FIRST_N_O, (count, list, BOOST_PP_NIL))))
57 # endif
58 #
59 # endif