MessagePack for C++
first_n.hpp
Go to the documentation of this file.
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 MSGPACK_PREPROCESSOR_LIST_FIRST_N_HPP
15 # define MSGPACK_PREPROCESSOR_LIST_FIRST_N_HPP
16 #
24 #
25 # /* MSGPACK_PP_LIST_FIRST_N */
26 #
27 # if ~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_EDG()
28 # define MSGPACK_PP_LIST_FIRST_N(count, list) MSGPACK_PP_LIST_REVERSE(MSGPACK_PP_TUPLE_ELEM(3, 2, MSGPACK_PP_WHILE(MSGPACK_PP_LIST_FIRST_N_P, MSGPACK_PP_LIST_FIRST_N_O, (count, list, MSGPACK_PP_NIL))))
29 # else
30 # define MSGPACK_PP_LIST_FIRST_N(count, list) MSGPACK_PP_LIST_FIRST_N_I(count, list)
31 # define MSGPACK_PP_LIST_FIRST_N_I(count, list) MSGPACK_PP_LIST_REVERSE(MSGPACK_PP_TUPLE_ELEM(3, 2, MSGPACK_PP_WHILE(MSGPACK_PP_LIST_FIRST_N_P, MSGPACK_PP_LIST_FIRST_N_O, (count, list, MSGPACK_PP_NIL))))
32 # endif
33 #
34 # if ~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_EDG()
35 # define MSGPACK_PP_LIST_FIRST_N_P(d, data) MSGPACK_PP_TUPLE_ELEM(3, 0, data)
36 # else
37 # define MSGPACK_PP_LIST_FIRST_N_P(d, data) MSGPACK_PP_LIST_FIRST_N_P_I data
38 # define MSGPACK_PP_LIST_FIRST_N_P_I(c, l, nl) c
39 # endif
40 #
41 # if ~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_MWCC()
42 # define MSGPACK_PP_LIST_FIRST_N_O(d, data) MSGPACK_PP_LIST_FIRST_N_O_D data
43 # else
44 # define MSGPACK_PP_LIST_FIRST_N_O(d, data) MSGPACK_PP_LIST_FIRST_N_O_D(MSGPACK_PP_TUPLE_ELEM(3, 0, data), MSGPACK_PP_TUPLE_ELEM(3, 1, data), MSGPACK_PP_TUPLE_ELEM(3, 2, data))
45 # endif
46 #
47 # define MSGPACK_PP_LIST_FIRST_N_O_D(c, l, nl) (MSGPACK_PP_DEC(c), MSGPACK_PP_LIST_REST(l), (MSGPACK_PP_LIST_FIRST(l), nl))
48 #
49 # /* MSGPACK_PP_LIST_FIRST_N_D */
50 #
51 # if ~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_EDG()
52 # define MSGPACK_PP_LIST_FIRST_N_D(d, count, list) MSGPACK_PP_LIST_REVERSE_D(d, MSGPACK_PP_TUPLE_ELEM(3, 2, MSGPACK_PP_WHILE_ ## d(MSGPACK_PP_LIST_FIRST_N_P, MSGPACK_PP_LIST_FIRST_N_O, (count, list, MSGPACK_PP_NIL))))
53 # else
54 # define MSGPACK_PP_LIST_FIRST_N_D(d, count, list) MSGPACK_PP_LIST_FIRST_N_D_I(d, count, list)
55 # define MSGPACK_PP_LIST_FIRST_N_D_I(d, count, list) MSGPACK_PP_LIST_REVERSE_D(d, MSGPACK_PP_TUPLE_ELEM(3, 2, MSGPACK_PP_WHILE_ ## d(MSGPACK_PP_LIST_FIRST_N_P, MSGPACK_PP_LIST_FIRST_N_O, (count, list, MSGPACK_PP_NIL))))
56 # endif
57 #
58 # endif