1 # /* Copyright (C) 2001
3 # * http://www.housemarque.com
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.
10 # * See http://www.boost.org for most recent version.
13 # /* Revised by Paul Mensonides (2002) */
15 # ifndef BOOST_PREPROCESSOR_LIST_ADT_HPP
16 # define BOOST_PREPROCESSOR_LIST_ADT_HPP
18 # include <boost/preprocessor/config/config.hpp>
19 # include <boost/preprocessor/detail/is_binary.hpp>
20 # include <boost/preprocessor/logical/compl.hpp>
21 # include <boost/preprocessor/tuple/eat.hpp>
23 # /* BOOST_PP_LIST_CONS */
25 # define BOOST_PP_LIST_CONS(head, tail) (head, tail)
27 # /* BOOST_PP_LIST_NIL */
29 # define BOOST_PP_LIST_NIL BOOST_PP_NIL
31 # /* BOOST_PP_LIST_FIRST */
33 # define BOOST_PP_LIST_FIRST(list) BOOST_PP_LIST_FIRST_D(list)
35 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
36 # define BOOST_PP_LIST_FIRST_D(list) BOOST_PP_LIST_FIRST_I list
38 # define BOOST_PP_LIST_FIRST_D(list) BOOST_PP_LIST_FIRST_I ## list
41 # define BOOST_PP_LIST_FIRST_I(head, tail) head
43 # /* BOOST_PP_LIST_REST */
45 # define BOOST_PP_LIST_REST(list) BOOST_PP_LIST_REST_D(list)
47 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC()
48 # define BOOST_PP_LIST_REST_D(list) BOOST_PP_LIST_REST_I list
50 # define BOOST_PP_LIST_REST_D(list) BOOST_PP_LIST_REST_I ## list
53 # define BOOST_PP_LIST_REST_I(head, tail) tail
55 # /* BOOST_PP_LIST_IS_CONS */
57 # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_BCC()
58 # define BOOST_PP_LIST_IS_CONS(list) BOOST_PP_LIST_IS_CONS_D(list)
59 # define BOOST_PP_LIST_IS_CONS_D(list) BOOST_PP_LIST_IS_CONS_ ## list
60 # define BOOST_PP_LIST_IS_CONS_(head, tail) 1
61 # define BOOST_PP_LIST_IS_CONS_BOOST_PP_NIL 0
63 # define BOOST_PP_LIST_IS_CONS(list) BOOST_PP_IS_BINARY(list)
66 # /* BOOST_PP_LIST_IS_NIL */
68 # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_BCC()
69 # define BOOST_PP_LIST_IS_NIL(list) BOOST_PP_COMPL(BOOST_PP_IS_BINARY(list))
71 # define BOOST_PP_LIST_IS_NIL(list) BOOST_PP_COMPL(BOOST_PP_LIST_IS_CONS(list))