]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/preprocessor/include/boost/preprocessor/list/first_n.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / preprocessor / include / boost / preprocessor / list / first_n.hpp
1 # /* Copyright (C) 2001
2 # * Housemarque Oy
3 # * http://www.housemarque.com
4 # *
5 # * Distributed under the Boost Software License, Version 1.0. (See
6 # * accompanying file LICENSE_1_0.txt or copy at
7 # * http://www.boost.org/LICENSE_1_0.txt)
8 # */
9 #
10 # /* Revised by Paul Mensonides (2002) */
11 #
12 # /* See http://www.boost.org for most recent version. */
13 #
14 # ifndef BOOST_PREPROCESSOR_LIST_FIRST_N_HPP
15 # define BOOST_PREPROCESSOR_LIST_FIRST_N_HPP
16 #
17 # include <boost/preprocessor/arithmetic/dec.hpp>
18 # include <boost/preprocessor/config/config.hpp>
19 # include <boost/preprocessor/control/while.hpp>
20 # include <boost/preprocessor/list/adt.hpp>
21 # include <boost/preprocessor/list/reverse.hpp>
22 # include <boost/preprocessor/tuple/elem.hpp>
23 # include <boost/preprocessor/tuple/rem.hpp>
24 #
25 # /* BOOST_PP_LIST_FIRST_N */
26 #
27 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
28 # 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))))
29 # else
30 # define BOOST_PP_LIST_FIRST_N(count, list) BOOST_PP_LIST_FIRST_N_I(count, list)
31 # 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))))
32 # endif
33 #
34 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
35 # define BOOST_PP_LIST_FIRST_N_P(d, data) BOOST_PP_TUPLE_ELEM(3, 0, data)
36 # else
37 # define BOOST_PP_LIST_FIRST_N_P(d, data) BOOST_PP_LIST_FIRST_N_P_I data
38 # define BOOST_PP_LIST_FIRST_N_P_I(c, l, nl) c
39 # endif
40 #
41 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
42 # define BOOST_PP_LIST_FIRST_N_O(d, data) BOOST_PP_LIST_FIRST_N_O_D data
43 # else
44 # 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))
45 # endif
46 #
47 # 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))
48 #
49 # /* BOOST_PP_LIST_FIRST_N_D */
50 #
51 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
52 # 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))))
53 # else
54 # define BOOST_PP_LIST_FIRST_N_D(d, count, list) BOOST_PP_LIST_FIRST_N_D_I(d, count, list)
55 # 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))))
56 # endif
57 #
58 # endif