MessagePack for C++
size.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_SIZE_HPP
15 # define MSGPACK_PREPROCESSOR_LIST_SIZE_HPP
16 #
23 #
24 # /* MSGPACK_PP_LIST_SIZE */
25 #
26 # if ~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_EDG()
27 # define MSGPACK_PP_LIST_SIZE(list) MSGPACK_PP_TUPLE_ELEM(2, 0, MSGPACK_PP_WHILE(MSGPACK_PP_LIST_SIZE_P, MSGPACK_PP_LIST_SIZE_O, (0, list)))
28 # else
29 # define MSGPACK_PP_LIST_SIZE(list) MSGPACK_PP_LIST_SIZE_I(list)
30 # define MSGPACK_PP_LIST_SIZE_I(list) MSGPACK_PP_TUPLE_ELEM(2, 0, MSGPACK_PP_WHILE(MSGPACK_PP_LIST_SIZE_P, MSGPACK_PP_LIST_SIZE_O, (0, list)))
31 # endif
32 #
33 # if ~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_EDG()
34 # define MSGPACK_PP_LIST_SIZE_P(d, rl) MSGPACK_PP_LIST_IS_CONS(MSGPACK_PP_TUPLE_ELEM(2, 1, rl))
35 # else
36 # define MSGPACK_PP_LIST_SIZE_P(d, rl) MSGPACK_PP_LIST_SIZE_P_I(MSGPACK_PP_TUPLE_REM_2 rl)
37 # define MSGPACK_PP_LIST_SIZE_P_I(im) MSGPACK_PP_LIST_SIZE_P_II(im)
38 # define MSGPACK_PP_LIST_SIZE_P_II(r, l) MSGPACK_PP_LIST_IS_CONS(l)
39 # endif
40 #
41 # if ~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_EDG()
42 # define MSGPACK_PP_LIST_SIZE_O(d, rl) (MSGPACK_PP_INC(MSGPACK_PP_TUPLE_ELEM(2, 0, rl)), MSGPACK_PP_LIST_REST(MSGPACK_PP_TUPLE_ELEM(2, 1, rl)))
43 # else
44 # define MSGPACK_PP_LIST_SIZE_O(d, rl) MSGPACK_PP_LIST_SIZE_O_I(MSGPACK_PP_TUPLE_REM_2 rl)
45 # define MSGPACK_PP_LIST_SIZE_O_I(im) MSGPACK_PP_LIST_SIZE_O_II(im)
46 # define MSGPACK_PP_LIST_SIZE_O_II(r, l) (MSGPACK_PP_INC(r), MSGPACK_PP_LIST_REST(l))
47 # endif
48 #
49 # /* MSGPACK_PP_LIST_SIZE_D */
50 #
51 # if ~MSGPACK_PP_CONFIG_FLAGS() & MSGPACK_PP_CONFIG_EDG()
52 # define MSGPACK_PP_LIST_SIZE_D(d, list) MSGPACK_PP_TUPLE_ELEM(2, 0, MSGPACK_PP_WHILE_ ## d(MSGPACK_PP_LIST_SIZE_P, MSGPACK_PP_LIST_SIZE_O, (0, list)))
53 # else
54 # define MSGPACK_PP_LIST_SIZE_D(d, list) MSGPACK_PP_LIST_SIZE_D_I(d, list)
55 # define MSGPACK_PP_LIST_SIZE_D_I(d, list) MSGPACK_PP_TUPLE_ELEM(2, 0, MSGPACK_PP_WHILE_ ## d(MSGPACK_PP_LIST_SIZE_P, MSGPACK_PP_LIST_SIZE_O, (0, list)))
56 # endif
57 #
58 # endif