File indexing completed on 2025-01-30 09:49:59
0001
0002
0003
0004
0005
0006
0007 #ifndef BOOST_PARAMETER_MACROS_050412_HPP
0008 #define BOOST_PARAMETER_MACROS_050412_HPP
0009
0010 #include <boost/parameter/config.hpp>
0011 #include <boost/preprocessor/repetition/enum_params.hpp>
0012
0013 #if !defined(BOOST_NO_SFINAE) && \
0014 !BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x592))
0015
0016 #define BOOST_PARAMETER_MATCH_TYPE(n, param) \
0017 , typename param::match<BOOST_PP_ENUM_PARAMS(n, T)>::type kw = param()
0018
0019
0020 #define BOOST_PARAMETER_MATCH_TYPE_Z(z, n, param) \
0021 , typename param::match<BOOST_PP_ENUM_PARAMS_Z(z, n, T)>::type kw = param()
0022
0023
0024 #else
0025
0026 #define BOOST_PARAMETER_MATCH_TYPE(n, param) , param kw = param()
0027
0028
0029 #define BOOST_PARAMETER_MATCH_TYPE_Z(z, n, param) , param kw = param()
0030
0031
0032 #endif
0033
0034 #include <boost/preprocessor/control/if.hpp>
0035 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
0036 #include <boost/preprocessor/tuple/elem.hpp>
0037 #include <boost/preprocessor/cat.hpp>
0038
0039 #if defined(BOOST_PARAMETER_HAS_PERFECT_FORWARDING)
0040
0041 #define BOOST_PARAMETER_FUN_0(z, n, params) \
0042 BOOST_PP_TUPLE_ELEM(3, 0, params) BOOST_PP_TUPLE_ELEM(3, 1, params)() \
0043 { \
0044 return BOOST_PP_CAT( \
0045 BOOST_PP_TUPLE_ELEM(3, 1, params) \
0046 , _with_named_params \
0047 )(BOOST_PP_TUPLE_ELEM(3, 2, params)()()); \
0048 }
0049
0050
0051 #include <utility>
0052
0053 #define BOOST_PARAMETER_FUN_DECL_PARAM(z, n, p) \
0054 ::std::forward<BOOST_PP_CAT(T, n)>(BOOST_PP_CAT(p, n))
0055
0056
0057 #include <boost/preprocessor/repetition/enum.hpp>
0058
0059 #define BOOST_PARAMETER_FUN_DEFN_1(z, n, params) \
0060 template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename T)> \
0061 BOOST_PP_TUPLE_ELEM(3, 0, params) \
0062 BOOST_PP_TUPLE_ELEM(3, 1, params)( \
0063 BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, T, && p) \
0064 BOOST_PARAMETER_MATCH_TYPE_Z( \
0065 z, n, BOOST_PP_TUPLE_ELEM(3, 2, params) \
0066 ) \
0067 ) \
0068 { \
0069 return BOOST_PP_CAT( \
0070 BOOST_PP_TUPLE_ELEM(3, 1, params) \
0071 , _with_named_params \
0072 )( \
0073 kw( \
0074 BOOST_PP_CAT(BOOST_PP_ENUM_, z)( \
0075 n, BOOST_PARAMETER_FUN_DECL_PARAM, p \
0076 ) \
0077 ) \
0078 ); \
0079 }
0080
0081
0082 #define BOOST_PARAMETER_FUN_DECL(z, n, params) \
0083 BOOST_PP_IF( \
0084 n \
0085 , BOOST_PARAMETER_FUN_DEFN_1 \
0086 , BOOST_PARAMETER_FUN_0 \
0087 )(z, n, params)
0088
0089
0090 #else
0091
0092 #define BOOST_PARAMETER_FUN_DEFN_0(z, n, params) \
0093 template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename T)> \
0094 BOOST_PP_TUPLE_ELEM(3, 0, params) \
0095 BOOST_PP_TUPLE_ELEM(3, 1, params)( \
0096 BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, T, const& p) \
0097 BOOST_PARAMETER_MATCH_TYPE_Z( \
0098 z, n, BOOST_PP_TUPLE_ELEM(3, 2, params) \
0099 ) \
0100 ) \
0101 { \
0102 return BOOST_PP_CAT( \
0103 BOOST_PP_TUPLE_ELEM(3, 1, params) \
0104 , _with_named_params \
0105 )(kw(BOOST_PP_ENUM_PARAMS_Z(z, n, p))); \
0106 }
0107
0108
0109 #include <boost/preprocessor/seq/seq.hpp>
0110
0111 #define BOOST_PARAMETER_FUN_0(z, n, seq) \
0112 BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq))) \
0113 BOOST_PP_TUPLE_ELEM(3, 1, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)))() \
0114 { \
0115 return BOOST_PP_CAT( \
0116 BOOST_PP_TUPLE_ELEM( \
0117 3, 1, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq)) \
0118 ) \
0119 , _with_named_params \
0120 )( \
0121 BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_TAIL(seq))) \
0122 ()() \
0123 ); \
0124 }
0125
0126
0127 #include <boost/parameter/aux_/preprocessor/binary_seq_to_args.hpp>
0128 #include <boost/preprocessor/seq/size.hpp>
0129
0130 #define BOOST_PARAMETER_FUN_DEFN_R(r, seq) \
0131 template < \
0132 BOOST_PP_ENUM_PARAMS( \
0133 BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(seq)) \
0134 , typename T \
0135 ) \
0136 > BOOST_PP_TUPLE_ELEM(3, 0, BOOST_PP_SEQ_HEAD(seq)) \
0137 BOOST_PP_TUPLE_ELEM(3, 1, BOOST_PP_SEQ_HEAD(seq))( \
0138 BOOST_PARAMETER_AUX_PP_BINARY_SEQ_TO_ARGS( \
0139 BOOST_PP_SEQ_TAIL(seq), (T)(p) \
0140 ) \
0141 BOOST_PARAMETER_MATCH_TYPE( \
0142 BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(seq)) \
0143 , BOOST_PP_TUPLE_ELEM(3, 2, BOOST_PP_SEQ_HEAD(seq)) \
0144 ) \
0145 ) \
0146 { \
0147 return BOOST_PP_CAT( \
0148 BOOST_PP_TUPLE_ELEM(3, 1, BOOST_PP_SEQ_HEAD(seq)) \
0149 , _with_named_params \
0150 )( \
0151 kw( \
0152 BOOST_PP_ENUM_PARAMS( \
0153 BOOST_PP_SEQ_SIZE(BOOST_PP_SEQ_TAIL(seq)), p \
0154 ) \
0155 ) \
0156 ); \
0157 }
0158
0159
0160 #include <boost/parameter/aux_/preprocessor/binary_seq_for_each.hpp>
0161 #include <boost/preprocessor/tuple/eat.hpp>
0162
0163 #define BOOST_PARAMETER_FUN_DEFN_1(z, n, params) \
0164 BOOST_PP_IF( \
0165 n \
0166 , BOOST_PARAMETER_AUX_PP_BINARY_SEQ_FOR_EACH_Z \
0167 , BOOST_PARAMETER_FUN_0 \
0168 )(z, n, (BOOST_PARAMETER_FUN_DEFN_R)(params))
0169
0170
0171 #include <boost/preprocessor/comparison/less.hpp>
0172
0173 #define BOOST_PARAMETER_FUN_DECL(z, n, params) \
0174 BOOST_PP_CAT( \
0175 BOOST_PARAMETER_FUN_DEFN_ \
0176 , BOOST_PP_LESS( \
0177 n \
0178 , BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY \
0179 ) \
0180 )(z, n, params)
0181
0182
0183 #endif
0184
0185 #include <boost/preprocessor/arithmetic/inc.hpp>
0186 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
0187
0188
0189
0190
0191
0192
0193
0194
0195
0196
0197
0198
0199
0200
0201
0202
0203
0204
0205
0206
0207
0208
0209
0210
0211
0212
0213
0214
0215
0216 #define BOOST_PARAMETER_MEMFUN(ret, name, lo, hi, parameters) \
0217 BOOST_PP_REPEAT_FROM_TO( \
0218 lo, BOOST_PP_INC(hi), BOOST_PARAMETER_FUN_DECL \
0219 , (ret, name, parameters) \
0220 ) \
0221 template <typename Params> \
0222 ret BOOST_PP_CAT(name, _with_named_params)(Params const& p)
0223
0224
0225 #define BOOST_PARAMETER_FUN(ret, name, lo, hi, parameters) \
0226 template <typename Params> \
0227 ret BOOST_PP_CAT(name, _with_named_params)(Params const& p); \
0228 BOOST_PARAMETER_MEMFUN(ret, name, lo, hi, parameters)
0229
0230
0231 #endif
0232