File indexing completed on 2025-01-18 09:53:36
0001
0002
0003
0004
0005
0006
0007 #if !defined(BOOST_VMD_DETAIL_IS_LIST_HPP)
0008 #define BOOST_VMD_DETAIL_IS_LIST_HPP
0009
0010 #include <boost/preprocessor/cat.hpp>
0011 #include <boost/preprocessor/comparison/equal.hpp>
0012 #include <boost/preprocessor/control/iif.hpp>
0013 #include <boost/preprocessor/control/while.hpp>
0014 #include <boost/preprocessor/debug/assert.hpp>
0015 #include <boost/preprocessor/facilities/empty.hpp>
0016 #include <boost/preprocessor/logical/bitor.hpp>
0017 #include <boost/preprocessor/logical/compl.hpp>
0018 #include <boost/preprocessor/punctuation/is_begin_parens.hpp>
0019 #include <boost/preprocessor/tuple/elem.hpp>
0020 #include <boost/preprocessor/tuple/size.hpp>
0021 #include <boost/preprocessor/variadic/elem.hpp>
0022 #include <boost/preprocessor/variadic/size.hpp>
0023 #include <boost/vmd/identity.hpp>
0024 #include <boost/vmd/is_empty.hpp>
0025 #include <boost/vmd/is_identifier.hpp>
0026 #include <boost/vmd/is_tuple.hpp>
0027 #include <boost/vmd/detail/nil_registration.hpp>
0028
0029 #define BOOST_VMD_DETAIL_IS_LIST_PROCESS_TUPLE(d,x) \
0030 BOOST_PP_IIF \
0031 ( \
0032 BOOST_VMD_IS_TUPLE(x), \
0033 BOOST_VMD_DETAIL_IS_LIST_PROCESS_TUPLE_SIZE, \
0034 BOOST_VMD_DETAIL_IS_LIST_ASSERT \
0035 ) \
0036 (d,x) \
0037
0038
0039 #define BOOST_VMD_DETAIL_IS_LIST_PROCESS_TUPLE_SIZE(d,x) \
0040 BOOST_PP_IIF \
0041 ( \
0042 BOOST_PP_EQUAL_D(d,2,BOOST_PP_TUPLE_SIZE(x)), \
0043 BOOST_VMD_DETAIL_IS_LIST_RETURN_SECOND, \
0044 BOOST_VMD_DETAIL_IS_LIST_ASSERT \
0045 ) \
0046 (x) \
0047
0048
0049 #define BOOST_VMD_DETAIL_IS_LIST_PRED(d,state) \
0050 BOOST_VMD_IDENTITY_RESULT \
0051 ( \
0052 BOOST_PP_IIF \
0053 ( \
0054 BOOST_PP_IS_BEGIN_PARENS(state), \
0055 BOOST_VMD_IDENTITY(1), \
0056 BOOST_VMD_DETAIL_IS_LIST_NOT_BOOST_PP_NIL \
0057 ) \
0058 (state) \
0059 ) \
0060
0061
0062 #define BOOST_VMD_DETAIL_IS_LIST_OP(d,state) \
0063 BOOST_PP_IIF \
0064 ( \
0065 BOOST_PP_IS_BEGIN_PARENS(state), \
0066 BOOST_VMD_DETAIL_IS_LIST_PROCESS_TUPLE, \
0067 BOOST_VMD_DETAIL_IS_LIST_PROCESS_IF_BOOST_PP_NIL \
0068 ) \
0069 (d,state) \
0070
0071
0072 #define BOOST_VMD_DETAIL_IS_LIST_PROCESS_IF_BOOST_PP_NIL(d,x) \
0073 BOOST_PP_IIF \
0074 ( \
0075 BOOST_VMD_DETAIL_IS_LIST_BOOST_PP_NIL(x), \
0076 BOOST_PP_NIL, \
0077 BOOST_VMD_IS_LIST_FAILURE \
0078 ) \
0079
0080
0081 #define BOOST_VMD_DETAIL_IS_LIST_ASSERT(...) \
0082 BOOST_VMD_IS_LIST_FAILURE \
0083
0084
0085 #define BOOST_VMD_DETAIL_IS_LIST_NOT_BOOST_PP_NIL(x) \
0086 BOOST_PP_COMPL \
0087 ( \
0088 BOOST_PP_BITOR \
0089 ( \
0090 BOOST_VMD_DETAIL_IS_LIST_BOOST_PP_NIL(x), \
0091 BOOST_VMD_DETAIL_IS_LIST_IS_FAILURE(x) \
0092 ) \
0093 ) \
0094
0095
0096 #define BOOST_VMD_DETAIL_IS_LIST_BOOST_PP_NIL(x) \
0097 BOOST_VMD_IS_EMPTY \
0098 ( \
0099 BOOST_PP_CAT \
0100 ( \
0101 BOOST_VMD_DETAIL_IS_LIST_NIL_HELPER_, \
0102 x \
0103 ) BOOST_PP_EMPTY() \
0104 ) \
0105
0106
0107 #define BOOST_VMD_DETAIL_IS_LIST_NIL_HELPER_BOOST_PP_NIL
0108
0109 #define BOOST_VMD_DETAIL_IS_LIST_IS_FAILURE(x) \
0110 BOOST_VMD_IS_EMPTY \
0111 ( \
0112 BOOST_PP_CAT(BOOST_VMD_DETAIL_IS_LIST_FHELPER_,x) BOOST_PP_EMPTY() \
0113 ) \
0114
0115
0116 #define BOOST_VMD_DETAIL_IS_LIST_FHELPER_BOOST_VMD_IS_LIST_FAILURE
0117
0118 #define BOOST_VMD_DETAIL_IS_LIST_RETURN_SECOND(x) \
0119 BOOST_PP_TUPLE_ELEM(1,x) \
0120
0121
0122 #define BOOST_VMD_DETAIL_IS_LIST_RESULT(x) \
0123 BOOST_PP_COMPL \
0124 ( \
0125 BOOST_VMD_DETAIL_IS_LIST_IS_FAILURE(x) \
0126 ) \
0127
0128
0129 #define BOOST_VMD_DETAIL_IS_LIST_WLOOP(list) \
0130 BOOST_VMD_DETAIL_IS_LIST_RESULT \
0131 ( \
0132 BOOST_PP_WHILE \
0133 ( \
0134 BOOST_VMD_DETAIL_IS_LIST_PRED, \
0135 BOOST_VMD_DETAIL_IS_LIST_OP, \
0136 list \
0137 ) \
0138 ) \
0139
0140
0141 #define BOOST_VMD_DETAIL_IS_LIST_WLOOP_D(d,list) \
0142 BOOST_VMD_DETAIL_IS_LIST_RESULT \
0143 ( \
0144 BOOST_PP_WHILE_ ## d \
0145 ( \
0146 BOOST_VMD_DETAIL_IS_LIST_PRED, \
0147 BOOST_VMD_DETAIL_IS_LIST_OP, \
0148 list \
0149 ) \
0150 ) \
0151
0152
0153 #define BOOST_VMD_DETAIL_IS_LIST_IS_EMPTY_LIST_PROCESS(list) \
0154 BOOST_VMD_IS_IDENTIFIER(list,BOOST_PP_NIL) \
0155
0156
0157 #define BOOST_VMD_DETAIL_IS_LIST_IS_EMPTY_LIST_PROCESS_D(d,list) \
0158 BOOST_VMD_IS_IDENTIFIER_D(d,list,BOOST_PP_NIL) \
0159
0160
0161 #define BOOST_VMD_DETAIL_IS_LIST_PROCESS(param) \
0162 BOOST_PP_IIF \
0163 ( \
0164 BOOST_PP_IS_BEGIN_PARENS(param), \
0165 BOOST_VMD_DETAIL_IS_LIST_WLOOP, \
0166 BOOST_VMD_DETAIL_IS_LIST_IS_EMPTY_LIST_PROCESS \
0167 ) \
0168 (param) \
0169
0170
0171 #define BOOST_VMD_DETAIL_IS_LIST(param) \
0172 BOOST_VMD_IDENTITY_RESULT \
0173 ( \
0174 BOOST_PP_IIF \
0175 ( \
0176 BOOST_VMD_IS_EMPTY(param), \
0177 BOOST_VMD_IDENTITY(0), \
0178 BOOST_VMD_DETAIL_IS_LIST_PROCESS \
0179 ) \
0180 (param) \
0181 ) \
0182
0183
0184 #define BOOST_VMD_DETAIL_IS_LIST_PROCESS_D(d,param) \
0185 BOOST_PP_IIF \
0186 ( \
0187 BOOST_PP_IS_BEGIN_PARENS(param), \
0188 BOOST_VMD_DETAIL_IS_LIST_WLOOP_D, \
0189 BOOST_VMD_DETAIL_IS_LIST_IS_EMPTY_LIST_PROCESS_D \
0190 ) \
0191 (d,param) \
0192
0193
0194 #define BOOST_VMD_DETAIL_IS_LIST_D(d,param) \
0195 BOOST_VMD_IDENTITY_RESULT \
0196 ( \
0197 BOOST_PP_IIF \
0198 ( \
0199 BOOST_VMD_IS_EMPTY(param), \
0200 BOOST_VMD_IDENTITY(0), \
0201 BOOST_VMD_DETAIL_IS_LIST_PROCESS_D \
0202 ) \
0203 (d,param) \
0204 ) \
0205
0206
0207 #endif