]> git.lyx.org Git - lyx.git/blob - boost/boost/preprocessor/list/size.hpp
update boost to version 1.29.0
[lyx.git] / boost / boost / preprocessor / list / size.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_SIZE_HPP
16 # define BOOST_PREPROCESSOR_LIST_SIZE_HPP
17 #
18 # include <boost/preprocessor/arithmetic/inc.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/tuple/elem.hpp>
23 # include <boost/preprocessor/tuple/rem.hpp>
24 #
25 # /* BOOST_PP_LIST_SIZE */
26 #
27 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
28 #    define BOOST_PP_LIST_SIZE(list) BOOST_PP_TUPLE_ELEM(2, 0, BOOST_PP_WHILE(BOOST_PP_LIST_SIZE_P, BOOST_PP_LIST_SIZE_O, (0, list)))
29 # else
30 #    define BOOST_PP_LIST_SIZE(list) BOOST_PP_LIST_SIZE_I(list)
31 #    define BOOST_PP_LIST_SIZE_I(list) BOOST_PP_TUPLE_ELEM(2, 0, BOOST_PP_WHILE(BOOST_PP_LIST_SIZE_P, BOOST_PP_LIST_SIZE_O, (0, list)))
32 # endif
33 #
34 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
35 #    define BOOST_PP_LIST_SIZE_P(d, rl) BOOST_PP_LIST_IS_CONS(BOOST_PP_TUPLE_ELEM(2, 1, rl))
36 # else
37 #    define BOOST_PP_LIST_SIZE_P(d, rl) BOOST_PP_LIST_SIZE_P_I(BOOST_PP_TUPLE_REM_2 rl)
38 #    define BOOST_PP_LIST_SIZE_P_I(im) BOOST_PP_LIST_SIZE_P_II(im)
39 #    define BOOST_PP_LIST_SIZE_P_II(r, l) BOOST_PP_LIST_IS_CONS(l)
40 # endif
41 #
42 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
43 #    define BOOST_PP_LIST_SIZE_O(d, rl) (BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(2, 0, rl)), BOOST_PP_LIST_REST(BOOST_PP_TUPLE_ELEM(2, 1, rl)))
44 # else
45 #    define BOOST_PP_LIST_SIZE_O(d, rl) BOOST_PP_LIST_SIZE_O_I(BOOST_PP_TUPLE_REM_2 rl)
46 #    define BOOST_PP_LIST_SIZE_O_I(im) BOOST_PP_LIST_SIZE_O_II(im)
47 #    define BOOST_PP_LIST_SIZE_O_II(r, l) (BOOST_PP_INC(r), BOOST_PP_LIST_REST(l))
48 # endif
49 #
50 # /* BOOST_PP_LIST_SIZE_D */
51 #
52 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG()
53 #    define BOOST_PP_LIST_SIZE_D(d, list) BOOST_PP_TUPLE_ELEM(2, 0, BOOST_PP_WHILE_ ## d(BOOST_PP_LIST_SIZE_P, BOOST_PP_LIST_SIZE_O, (0, list)))
54 # else
55 #    define BOOST_PP_LIST_SIZE_D(d, list) BOOST_PP_LIST_SIZE_D_I(d, list)
56 #    define BOOST_PP_LIST_SIZE_D_I(d, list) BOOST_PP_TUPLE_ELEM(2, 0, BOOST_PP_WHILE_ ## d(BOOST_PP_LIST_SIZE_P, BOOST_PP_LIST_SIZE_O, (0, list)))
57 # endif
58 #
59 # endif