File indexing completed on 2025-01-18 09:53:38
0001
0002
0003
0004
0005
0006
0007 #if !defined(BOOST_VMD_DETAIL_SEQUENCE_TYPE_HPP)
0008 #define BOOST_VMD_DETAIL_SEQUENCE_TYPE_HPP
0009
0010 #include <boost/preprocessor/comparison/equal.hpp>
0011 #include <boost/preprocessor/control/iif.hpp>
0012 #include <boost/preprocessor/tuple/elem.hpp>
0013 #include <boost/preprocessor/variadic/elem.hpp>
0014 #include <boost/preprocessor/variadic/size.hpp>
0015 #include <boost/vmd/identity.hpp>
0016 #include <boost/vmd/is_empty.hpp>
0017 #include <boost/vmd/detail/equal_type.hpp>
0018 #include <boost/vmd/detail/is_array_common.hpp>
0019 #include <boost/vmd/detail/is_list.hpp>
0020 #include <boost/vmd/detail/modifiers.hpp>
0021 #include <boost/vmd/detail/mods.hpp>
0022 #include <boost/vmd/detail/sequence_elem.hpp>
0023
0024 #define BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_ARRAY(dtuple) \
0025 BOOST_PP_IIF \
0026 ( \
0027 BOOST_VMD_DETAIL_IS_ARRAY_SYNTAX(BOOST_PP_TUPLE_ELEM(1,dtuple)), \
0028 BOOST_VMD_TYPE_ARRAY, \
0029 BOOST_VMD_TYPE_TUPLE \
0030 ) \
0031
0032
0033 #define BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_ARRAY_D(d,dtuple) \
0034 BOOST_PP_IIF \
0035 ( \
0036 BOOST_VMD_DETAIL_IS_ARRAY_SYNTAX_D(d,BOOST_PP_TUPLE_ELEM(1,dtuple)), \
0037 BOOST_VMD_TYPE_ARRAY, \
0038 BOOST_VMD_TYPE_TUPLE \
0039 ) \
0040
0041
0042 #define BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_LIST(dtuple) \
0043 BOOST_PP_IIF \
0044 ( \
0045 BOOST_VMD_DETAIL_IS_LIST(BOOST_PP_TUPLE_ELEM(1,dtuple)), \
0046 BOOST_VMD_TYPE_LIST, \
0047 BOOST_VMD_TYPE_TUPLE \
0048 ) \
0049
0050
0051 #define BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_LIST_D(d,dtuple) \
0052 BOOST_PP_IIF \
0053 ( \
0054 BOOST_VMD_DETAIL_IS_LIST_D(d,BOOST_PP_TUPLE_ELEM(1,dtuple)), \
0055 BOOST_VMD_TYPE_LIST, \
0056 BOOST_VMD_TYPE_TUPLE \
0057 ) \
0058
0059
0060 #define BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_BOTH(dtuple) \
0061 BOOST_VMD_IDENTITY_RESULT \
0062 ( \
0063 BOOST_PP_IIF \
0064 ( \
0065 BOOST_VMD_DETAIL_EQUAL_TYPE \
0066 ( \
0067 BOOST_VMD_TYPE_TUPLE, \
0068 BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_LIST(dtuple) \
0069 ), \
0070 BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_ARRAY, \
0071 BOOST_VMD_IDENTITY(BOOST_VMD_TYPE_LIST) \
0072 ) \
0073 (dtuple) \
0074 ) \
0075
0076
0077 #define BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_BOTH_D(d,dtuple) \
0078 BOOST_VMD_IDENTITY_RESULT \
0079 ( \
0080 BOOST_PP_IIF \
0081 ( \
0082 BOOST_VMD_DETAIL_EQUAL_TYPE_D \
0083 ( \
0084 d, \
0085 BOOST_VMD_TYPE_TUPLE, \
0086 BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_LIST_D(d,dtuple) \
0087 ), \
0088 BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_ARRAY_D, \
0089 BOOST_VMD_IDENTITY(BOOST_VMD_TYPE_LIST) \
0090 ) \
0091 (d,dtuple) \
0092 ) \
0093
0094
0095 #define BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_MODS(dtuple,rtype) \
0096 BOOST_VMD_IDENTITY_RESULT \
0097 ( \
0098 BOOST_PP_IIF \
0099 ( \
0100 BOOST_PP_EQUAL(rtype,BOOST_VMD_DETAIL_MODS_RETURN_ARRAY), \
0101 BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_ARRAY, \
0102 BOOST_PP_IIF \
0103 ( \
0104 BOOST_PP_EQUAL(rtype,BOOST_VMD_DETAIL_MODS_RETURN_LIST), \
0105 BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_LIST, \
0106 BOOST_PP_IIF \
0107 ( \
0108 BOOST_PP_EQUAL(rtype,BOOST_VMD_DETAIL_MODS_RETURN_TUPLE), \
0109 BOOST_VMD_IDENTITY(BOOST_PP_TUPLE_ELEM(0,dtuple)), \
0110 BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_BOTH \
0111 ) \
0112 ) \
0113 ) \
0114 ) \
0115 (dtuple) \
0116
0117
0118 #define BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_MODS_D(d,dtuple,rtype) \
0119 BOOST_VMD_IDENTITY_RESULT \
0120 ( \
0121 BOOST_PP_IIF \
0122 ( \
0123 BOOST_PP_EQUAL_D(d,rtype,BOOST_VMD_DETAIL_MODS_RETURN_ARRAY), \
0124 BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_ARRAY_D, \
0125 BOOST_PP_IIF \
0126 ( \
0127 BOOST_PP_EQUAL_D(d,rtype,BOOST_VMD_DETAIL_MODS_RETURN_LIST), \
0128 BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_LIST_D, \
0129 BOOST_PP_IIF \
0130 ( \
0131 BOOST_PP_EQUAL_D(d,rtype,BOOST_VMD_DETAIL_MODS_RETURN_TUPLE), \
0132 BOOST_VMD_IDENTITY(BOOST_PP_TUPLE_ELEM(0,dtuple)), \
0133 BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_BOTH_D \
0134 ) \
0135 ) \
0136 ) \
0137 ) \
0138 (d,dtuple) \
0139
0140
0141 #define BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_MORE(dtuple,...) \
0142 BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_MODS \
0143 ( \
0144 dtuple, \
0145 BOOST_VMD_DETAIL_MODS_RESULT_RETURN_TYPE \
0146 ( \
0147 BOOST_VMD_DETAIL_NEW_MODS(BOOST_VMD_ALLOW_ALL,__VA_ARGS__) \
0148 ) \
0149 ) \
0150
0151
0152 #define BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_MORE_D(d,dtuple,...) \
0153 BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_MODS_D \
0154 ( \
0155 d, \
0156 dtuple, \
0157 BOOST_VMD_DETAIL_MODS_RESULT_RETURN_TYPE \
0158 ( \
0159 BOOST_VMD_DETAIL_NEW_MODS_D(d,BOOST_VMD_ALLOW_ALL,__VA_ARGS__) \
0160 ) \
0161 ) \
0162
0163
0164 #define BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_UNARY(dtuple,...) \
0165 BOOST_VMD_IDENTITY_RESULT \
0166 ( \
0167 BOOST_PP_IIF \
0168 ( \
0169 BOOST_VMD_DETAIL_EQUAL_TYPE(BOOST_VMD_TYPE_TUPLE,BOOST_PP_TUPLE_ELEM(0,dtuple)), \
0170 BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_MORE, \
0171 BOOST_VMD_IDENTITY(BOOST_PP_TUPLE_ELEM(0,dtuple)) \
0172 ) \
0173 (dtuple,__VA_ARGS__) \
0174 ) \
0175
0176
0177 #define BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_UNARY_D(d,dtuple,...) \
0178 BOOST_VMD_IDENTITY_RESULT \
0179 ( \
0180 BOOST_PP_IIF \
0181 ( \
0182 BOOST_VMD_DETAIL_EQUAL_TYPE_D(d,BOOST_VMD_TYPE_TUPLE,BOOST_PP_TUPLE_ELEM(0,dtuple)), \
0183 BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_MORE_D, \
0184 BOOST_VMD_IDENTITY(BOOST_PP_TUPLE_ELEM(0,dtuple)) \
0185 ) \
0186 (d,dtuple,__VA_ARGS__) \
0187 ) \
0188
0189
0190 #define BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_SEQUENCE(tuple,...) \
0191 BOOST_VMD_IDENTITY_RESULT \
0192 ( \
0193 BOOST_PP_IIF \
0194 ( \
0195 BOOST_VMD_IS_EMPTY(BOOST_PP_TUPLE_ELEM(1,tuple)), \
0196 BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_UNARY, \
0197 BOOST_VMD_IDENTITY(BOOST_VMD_TYPE_SEQUENCE) \
0198 ) \
0199 (BOOST_PP_TUPLE_ELEM(0,tuple),__VA_ARGS__) \
0200 ) \
0201
0202
0203 #define BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_SEQUENCE_D(d,tuple,...) \
0204 BOOST_VMD_IDENTITY_RESULT \
0205 ( \
0206 BOOST_PP_IIF \
0207 ( \
0208 BOOST_VMD_IS_EMPTY(BOOST_PP_TUPLE_ELEM(1,tuple)), \
0209 BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_UNARY_D, \
0210 BOOST_VMD_IDENTITY(BOOST_VMD_TYPE_SEQUENCE) \
0211 ) \
0212 (d,BOOST_PP_TUPLE_ELEM(0,tuple),__VA_ARGS__) \
0213 ) \
0214
0215
0216 #define BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE(tuple,...) \
0217 BOOST_VMD_IDENTITY_RESULT \
0218 ( \
0219 BOOST_PP_IIF \
0220 ( \
0221 BOOST_VMD_IS_EMPTY(BOOST_PP_TUPLE_ELEM(0,tuple)), \
0222 BOOST_VMD_IDENTITY(BOOST_VMD_TYPE_EMPTY), \
0223 BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_SEQUENCE \
0224 ) \
0225 (tuple,__VA_ARGS__) \
0226 ) \
0227
0228
0229 #define BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_D(d,tuple,...) \
0230 BOOST_VMD_IDENTITY_RESULT \
0231 ( \
0232 BOOST_PP_IIF \
0233 ( \
0234 BOOST_VMD_IS_EMPTY(BOOST_PP_TUPLE_ELEM(0,tuple)), \
0235 BOOST_VMD_IDENTITY(BOOST_VMD_TYPE_EMPTY), \
0236 BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_SEQUENCE_D \
0237 ) \
0238 (d,tuple,__VA_ARGS__) \
0239 ) \
0240
0241
0242 #define BOOST_VMD_DETAIL_SEQUENCE_TYPE(...) \
0243 BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE \
0244 ( \
0245 BOOST_VMD_DETAIL_SEQUENCE_ELEM \
0246 ( \
0247 BOOST_VMD_ALLOW_ALL, \
0248 0, \
0249 BOOST_PP_VARIADIC_ELEM(0,__VA_ARGS__), \
0250 BOOST_VMD_RETURN_AFTER, \
0251 BOOST_VMD_RETURN_TYPE_TUPLE \
0252 ), \
0253 __VA_ARGS__ \
0254 ) \
0255
0256
0257 #define BOOST_VMD_DETAIL_SEQUENCE_TYPE_D(d,...) \
0258 BOOST_VMD_DETAIL_SEQUENCE_TYPE_TUPLE_D \
0259 ( \
0260 d, \
0261 BOOST_VMD_DETAIL_SEQUENCE_ELEM_D \
0262 ( \
0263 d, \
0264 BOOST_VMD_ALLOW_ALL, \
0265 0, \
0266 BOOST_PP_VARIADIC_ELEM(0,__VA_ARGS__), \
0267 BOOST_VMD_RETURN_AFTER, \
0268 BOOST_VMD_RETURN_TYPE_TUPLE \
0269 ), \
0270 __VA_ARGS__ \
0271 ) \
0272
0273
0274 #endif