1 // Copyright Daniel Wallin 2005. Use, modification and distribution is
2 // subject to the Boost Software License, Version 1.0. (See accompanying
3 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 #include <boost/preprocessor/cat.hpp>
6 #include <boost/preprocessor/dec.hpp>
7 #include <boost/preprocessor/repetition/enum_binary_params.hpp>
8 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
10 #define N BOOST_PP_ITERATION()
12 #define BOOST_PARAMETER_PY_ARG_TYPES(z, n, _) \
13 typedef typename mpl::next< \
14 BOOST_PP_CAT(iter,BOOST_PP_DEC(n)) \
15 >::type BOOST_PP_CAT(iter,n); \
17 typedef typename mpl::deref<BOOST_PP_CAT(iter,n)>::type BOOST_PP_CAT(spec,n); \
18 typedef typename mpl::if_< \
20 mpl::not_<typename BOOST_PP_CAT(spec,n)::required> \
21 , typename BOOST_PP_CAT(spec,n)::optimized_default \
23 , parameter::aux::maybe<typename BOOST_PP_CAT(spec,n)::type> \
24 , typename BOOST_PP_CAT(spec,n)::type \
25 >::type BOOST_PP_CAT(arg,n); \
26 typedef typename BOOST_PP_CAT(spec,n)::keyword BOOST_PP_CAT(kw,n);
28 #if BOOST_PP_ITERATION_FLAGS() == 1
29 template <class M, class R, class Args>
30 struct invoker<N, M, R, Args>
31 #elif BOOST_PP_ITERATION_FLAGS() == 2
32 template <class T, class R, class Args>
33 struct call_invoker<N, T, R, Args>
34 #elif BOOST_PP_ITERATION_FLAGS() == 3
35 template <class T, class Args>
36 struct init_invoker<N, T, Args>
37 #elif BOOST_PP_ITERATION_FLAGS() == 4
38 template <class M, class R, class T, class Args>
39 struct member_invoker<N, M, R, T, Args>
42 typedef typename mpl::begin<Args>::type iter0;
43 typedef typename mpl::deref<iter0>::type spec0;
44 typedef typename mpl::if_<
46 mpl::not_<typename spec0::required>
47 , typename spec0::optimized_default
49 , parameter::aux::maybe<typename spec0::type>
50 , typename spec0::type
52 typedef typename spec0::keyword kw0;
54 BOOST_PP_REPEAT_FROM_TO(1, N, BOOST_PARAMETER_PY_ARG_TYPES, ~)
57 #if BOOST_PP_ITERATION_FLAGS() == 3
63 #if BOOST_PP_ITERATION_FLAGS() == 2 || BOOST_PP_ITERATION_FLAGS() == 4
67 BOOST_PP_ENUM_BINARY_PARAMS(N, arg, a)
71 #if BOOST_PP_ITERATION_FLAGS() == 1 || BOOST_PP_ITERATION_FLAGS() == 4
74 # if BOOST_PP_ITERATION_FLAGS() == 4
77 , BOOST_PP_ENUM_BINARY_PARAMS(N, parameter::keyword<kw, >::get() = a)
79 #elif BOOST_PP_ITERATION_FLAGS() == 2
81 BOOST_PP_ENUM_BINARY_PARAMS(N, parameter::keyword<kw, >::get() = a)
83 #elif BOOST_PP_ITERATION_FLAGS() == 3
85 BOOST_PP_ENUM_BINARY_PARAMS(N, parameter::keyword<kw, >::get() = a)
91 #undef BOOST_PARAMETER_PY_ARG_TYPES