File indexing completed on 2025-01-18 09:50:26
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef BOOST_PROTO_DETAIL_DEPRECATED_HPP_EAN_11_25_2008
0011 #define BOOST_PROTO_DETAIL_DEPRECATED_HPP_EAN_11_25_2008
0012
0013 #include <boost/preprocessor/cat.hpp>
0014 #include <boost/preprocessor/facilities/intercept.hpp>
0015 #include <boost/preprocessor/arithmetic/inc.hpp>
0016 #include <boost/preprocessor/arithmetic/dec.hpp>
0017 #include <boost/preprocessor/arithmetic/sub.hpp>
0018 #include <boost/preprocessor/punctuation/comma_if.hpp>
0019 #include <boost/preprocessor/control/if.hpp>
0020 #include <boost/preprocessor/control/expr_if.hpp>
0021 #include <boost/preprocessor/comparison/greater.hpp>
0022 #include <boost/preprocessor/tuple/elem.hpp>
0023 #include <boost/preprocessor/tuple/to_list.hpp>
0024 #include <boost/preprocessor/logical/and.hpp>
0025 #include <boost/preprocessor/seq/size.hpp>
0026 #include <boost/preprocessor/seq/enum.hpp>
0027 #include <boost/preprocessor/seq/seq.hpp>
0028 #include <boost/preprocessor/seq/to_tuple.hpp>
0029 #include <boost/preprocessor/seq/for_each_i.hpp>
0030 #include <boost/preprocessor/seq/pop_back.hpp>
0031 #include <boost/preprocessor/seq/push_back.hpp>
0032 #include <boost/preprocessor/seq/push_front.hpp>
0033 #include <boost/preprocessor/list/for_each_i.hpp>
0034 #include <boost/preprocessor/repetition/repeat.hpp>
0035 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
0036 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
0037 #include <boost/preprocessor/repetition/enum_trailing_binary_params.hpp>
0038 #include <boost/proto/proto_fwd.hpp>
0039
0040
0041
0042 #define BOOST_PROTO_VARARG_TEMPLATE_AUX_(R, DATA, I, ELEM) \
0043 (ELEM BOOST_PP_CAT(BOOST_PP_CAT(X, DATA), BOOST_PP_CAT(_, I))) \
0044
0045
0046
0047
0048 #define BOOST_PROTO_VARARG_TEMPLATE_YES_(R, DATA, I, ELEM) \
0049 BOOST_PP_LIST_FOR_EACH_I_R( \
0050 R \
0051 , BOOST_PROTO_VARARG_TEMPLATE_AUX_ \
0052 , I \
0053 , BOOST_PP_TUPLE_TO_LIST( \
0054 BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ELEM)) \
0055 , BOOST_PP_SEQ_TO_TUPLE(BOOST_PP_SEQ_TAIL(ELEM)) \
0056 ) \
0057 ) \
0058
0059
0060
0061
0062 #define BOOST_PROTO_VARARG_TEMPLATE_NO_(R, DATA, I, ELEM) \
0063
0064
0065
0066
0067 #define BOOST_PROTO_VARARG_TEMPLATE_(R, DATA, I, ELEM) \
0068 BOOST_PP_IF( \
0069 BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ELEM)) \
0070 , BOOST_PROTO_VARARG_TEMPLATE_YES_ \
0071 , BOOST_PROTO_VARARG_TEMPLATE_NO_ \
0072 )(R, DATA, I, ELEM) \
0073
0074
0075
0076
0077 #define BOOST_PROTO_VARARG_TYPE_AUX_(R, DATA, I, ELEM) \
0078 (BOOST_PP_CAT(BOOST_PP_CAT(X, DATA), BOOST_PP_CAT(_, I))) \
0079
0080
0081
0082
0083 #define BOOST_PROTO_TEMPLATE_PARAMS_YES_(R, DATA, I, ELEM) \
0084 < \
0085 BOOST_PP_SEQ_ENUM( \
0086 BOOST_PP_LIST_FOR_EACH_I_R( \
0087 R \
0088 , BOOST_PROTO_VARARG_TYPE_AUX_ \
0089 , I \
0090 , BOOST_PP_TUPLE_TO_LIST( \
0091 BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ELEM)) \
0092 , BOOST_PP_SEQ_TO_TUPLE(BOOST_PP_SEQ_TAIL(ELEM)) \
0093 ) \
0094 ) \
0095 ) \
0096 > \
0097
0098
0099
0100
0101 #define BOOST_PROTO_TEMPLATE_PARAMS_NO_(R, DATA, I, ELEM) \
0102
0103
0104
0105
0106 #define BOOST_PROTO_VARARG_TYPE_(R, DATA, I, ELEM) \
0107 BOOST_PP_COMMA_IF(I) \
0108 BOOST_PP_SEQ_HEAD(ELEM) \
0109 BOOST_PP_IF( \
0110 BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ELEM)) \
0111 , BOOST_PROTO_TEMPLATE_PARAMS_YES_ \
0112 , BOOST_PROTO_TEMPLATE_PARAMS_NO_ \
0113 )(R, DATA, I, ELEM) BOOST_PP_EXPR_IF(BOOST_PP_GREATER(I, 1), const) \
0114
0115
0116
0117
0118 #define BOOST_PROTO_VARARG_AS_EXPR_(R, DATA, I, ELEM) \
0119 BOOST_PP_EXPR_IF( \
0120 BOOST_PP_GREATER(I, 1) \
0121 , (( \
0122 BOOST_PP_SEQ_HEAD(ELEM) \
0123 BOOST_PP_IF( \
0124 BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(ELEM)) \
0125 , BOOST_PROTO_TEMPLATE_PARAMS_YES_ \
0126 , BOOST_PROTO_TEMPLATE_PARAMS_NO_ \
0127 )(R, DATA, I, ELEM)() \
0128 )) \
0129 ) \
0130
0131
0132
0133
0134 #define BOOST_PROTO_VARARG_AS_CHILD_(Z, N, DATA) \
0135 (BOOST_PP_CAT(DATA, N)) \
0136
0137
0138
0139
0140 #define BOOST_PROTO_SEQ_PUSH_FRONT(SEQ, ELEM) \
0141 BOOST_PP_SEQ_POP_BACK(BOOST_PP_SEQ_PUSH_FRONT(BOOST_PP_SEQ_PUSH_BACK(SEQ, _dummy_), ELEM)) \
0142
0143
0144
0145
0146 #define BOOST_PROTO_VARARG_AS_PARAM_(Z, N, DATA) \
0147 (BOOST_PP_CAT(DATA, N)) \
0148
0149
0150
0151
0152 #define BOOST_PROTO_VARARG_FUN_(Z, N, DATA) \
0153 template< \
0154 BOOST_PP_SEQ_ENUM( \
0155 BOOST_PP_SEQ_FOR_EACH_I( \
0156 BOOST_PROTO_VARARG_TEMPLATE_, ~ \
0157 , BOOST_PP_SEQ_PUSH_FRONT( \
0158 BOOST_PROTO_SEQ_PUSH_FRONT( \
0159 BOOST_PP_TUPLE_ELEM(4, 2, DATA) \
0160 , (BOOST_PP_TUPLE_ELEM(4, 3, DATA)) \
0161 ) \
0162 , BOOST_PP_TUPLE_ELEM(4, 1, DATA) \
0163 ) \
0164 ) \
0165 BOOST_PP_REPEAT_ ## Z(N, BOOST_PROTO_VARARG_AS_PARAM_, typename A) \
0166 ) \
0167 > \
0168 typename boost::proto::result_of::make_expr< \
0169 BOOST_PP_SEQ_FOR_EACH_I( \
0170 BOOST_PROTO_VARARG_TYPE_, ~ \
0171 , BOOST_PP_SEQ_PUSH_FRONT( \
0172 BOOST_PROTO_SEQ_PUSH_FRONT( \
0173 BOOST_PP_TUPLE_ELEM(4, 2, DATA) \
0174 , (BOOST_PP_TUPLE_ELEM(4, 3, DATA)) \
0175 ) \
0176 , BOOST_PP_TUPLE_ELEM(4, 1, DATA) \
0177 ) \
0178 ) \
0179 BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(Z, N, A, const & BOOST_PP_INTERCEPT) \
0180 >::type const \
0181 BOOST_PP_TUPLE_ELEM(4, 0, DATA)(BOOST_PP_ENUM_BINARY_PARAMS_Z(Z, N, A, const &a)) \
0182 { \
0183 return boost::proto::detail::make_expr_< \
0184 BOOST_PP_SEQ_FOR_EACH_I( \
0185 BOOST_PROTO_VARARG_TYPE_, ~ \
0186 , BOOST_PP_SEQ_PUSH_FRONT( \
0187 BOOST_PROTO_SEQ_PUSH_FRONT( \
0188 BOOST_PP_TUPLE_ELEM(4, 2, DATA) \
0189 , (BOOST_PP_TUPLE_ELEM(4, 3, DATA)) \
0190 ) \
0191 , BOOST_PP_TUPLE_ELEM(4, 1, DATA) \
0192 ) \
0193 ) \
0194 BOOST_PP_ENUM_TRAILING_BINARY_PARAMS_Z(Z, N, A, const & BOOST_PP_INTERCEPT) \
0195 >()( \
0196 BOOST_PP_SEQ_ENUM( \
0197 BOOST_PP_SEQ_FOR_EACH_I( \
0198 BOOST_PROTO_VARARG_AS_EXPR_, ~ \
0199 , BOOST_PP_SEQ_PUSH_FRONT( \
0200 BOOST_PROTO_SEQ_PUSH_FRONT( \
0201 BOOST_PP_TUPLE_ELEM(4, 2, DATA) \
0202 , (BOOST_PP_TUPLE_ELEM(4, 3, DATA)) \
0203 ) \
0204 , BOOST_PP_TUPLE_ELEM(4, 1, DATA) \
0205 ) \
0206 ) \
0207 BOOST_PP_REPEAT_ ## Z(N, BOOST_PROTO_VARARG_AS_CHILD_, a) \
0208 ) \
0209 ); \
0210 } \
0211
0212
0213
0214
0215
0216
0217
0218
0219
0220
0221
0222 #define BOOST_PROTO_DEFINE_FUNCTION_TEMPLATE(ARGCOUNT, NAME, DOMAIN, TAG, BOUNDARGS) \
0223 BOOST_PP_REPEAT_FROM_TO( \
0224 ARGCOUNT \
0225 , BOOST_PP_INC(ARGCOUNT) \
0226 , BOOST_PROTO_VARARG_FUN_ \
0227 , (NAME, TAG, BOUNDARGS, DOMAIN) \
0228 )\
0229
0230
0231
0232
0233
0234
0235
0236
0237
0238
0239 #define BOOST_PROTO_DEFINE_VARARG_FUNCTION_TEMPLATE(NAME, DOMAIN, TAG, BOUNDARGS) \
0240 BOOST_PP_REPEAT( \
0241 BOOST_PP_SUB(BOOST_PP_INC(BOOST_PROTO_MAX_ARITY), BOOST_PP_SEQ_SIZE(BOUNDARGS)) \
0242 , BOOST_PROTO_VARARG_FUN_ \
0243 , (NAME, TAG, BOUNDARGS, DOMAIN) \
0244 ) \
0245
0246
0247 #endif