1+ #if !defined(BOOST_PP_IS_ITERATING)
2+
13// Copyright David Abrahams 2002. Permission to copy, use,
24// modify, sell and distribute this software is granted provided this
35// copyright notice appears in all copies. This software is provided
46// "as is" without express or implied warranty, and with no claim as
57// to its suitability for any purpose.
68#ifndef ARGS_DWA2002323_HPP
79# define ARGS_DWA2002323_HPP
8- # include < boost/config.hpp>
9- # include < boost/mpl/type_list.hpp>
10- # include < boost/python/detail/preprocessor.hpp>
11- # include < boost/preprocessor/enum_params.hpp>
12- # include < boost/preprocessor/enum_params_with_a_default.hpp>
13- # include < boost/preprocessor/comma_if.hpp>
10+ # include < boost/config.hpp>
11+
12+ # include < boost/python/detail/preprocessor.hpp>
13+
14+ # include < boost/mpl/type_list.hpp>
1415
15- # if !defined(__EDG_VERSION__) || __EDG_VERSION__ > 245
16- namespace boost { namespace python {
16+ # include < boost/preprocessor/cat.hpp >
17+ # include < boost/preprocessor/iterate.hpp >
1718
19+ # if !defined(__EDG_VERSION__) || __EDG_VERSION__ > 245
20+
21+ namespace boost { namespace python {
1822
1923// A type list for specifying arguments
20- template < BOOST_MPL_LIST_DEFAULT_PARAMETERS( typename A, boost::mpl::null_argument) >
21- struct args : boost::mpl::type_list< BOOST_MPL_LIST_PARAMETERS( A) >::type
24+ template < BOOST_PYTHON_ENUM_WITH_DEFAULT(BOOST_PYTHON_MAX_ARITY, typename A, boost::mpl::null_argument) >
25+ struct args : boost::mpl::type_list< BOOST_PYTHON_UNARY_ENUM(BOOST_PYTHON_MAX_ARITY, A) >::type
2226{};
2327
2428}} // namespace boost::python
2529
26- # else // slow template instantiators need this other version with
27- // explicit specializations of mpl::size<> and
28- // mpl::at<>. Eventually, however, inheritance from mpl::list
29- // *should* be eliminated and the two versions unified, just in
30- // order to get true arity independence
30+ # else // slow template instantiators need this other version with
31+ // explicit specializations of mpl::size<> and
32+ // mpl::at<>. Eventually, however, inheritance from mpl::list
33+ // *should* be eliminated and the two versions unified, just in
34+ // order to get true arity independence
3135
32- namespace boost { namespace python {
36+ namespace boost { namespace python {
3337
34- template < BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT (BOOST_PYTHON_MAX_ARITY, class A , boost::mpl::null_argument) >
38+ template < BOOST_PYTHON_ENUM_WITH_DEFAULT (BOOST_PYTHON_MAX_ARITY, typename A, boost::mpl::null_argument) >
3539struct args
3640{};
3741
@@ -42,32 +46,45 @@ namespace boost { namespace mpl {
4246template <class T > struct size ;
4347template <long N, class Seq > struct at ;
4448
45- # ifndef BOOST_PYTHON_GENERATE_CODE
46- # include < boost/python/preprocessed/args.hpp>
47- # endif
48-
49- # define BOOST_PYTHON_ARGS_SIZE (index,ignored ) \
50- template <BOOST_PP_ENUM_PARAMS(index, class A )> \
51- struct size <boost::python::args<BOOST_PP_ENUM_PARAMS(index, A)> > \
52- { \
53- BOOST_STATIC_CONSTANT (long , value = index); \
54- }; \
55-
56- BOOST_PYTHON_REPEAT_ARITY_2ND (BOOST_PYTHON_ARGS_SIZE, nil)
57-
58- # define BOOST_PYTHON_ARGS_AT (index,ignored ) \
59- template < \
60- BOOST_PP_ENUM_PARAMS (BOOST_PP_DEC(BOOST_PYTHON_ARITY_FINISH), class A )> \
61- struct at <index, boost::python::args< \
62- BOOST_PP_ENUM_PARAMS (BOOST_PP_DEC(BOOST_PYTHON_ARITY_FINISH), A)> > \
63- { \
64- typedef BOOST_PP_CAT (A,index) type; \
65- }; \
66-
67- BOOST_PP_REPEAT_FROM_TO_2ND (
68- BOOST_PP_DEC (BOOST_PYTHON_ARITY_START), BOOST_PP_DEC(BOOST_PYTHON_ARITY_FINISH)
69- , BOOST_PYTHON_ARGS_AT, data)
70-
71- }}
72- # endif
73- #endif // ARGS_DWA2002323_HPP
49+ # define BOOST_PP_ITERATION_PARAMS_1 4 , (0 , BOOST_PYTHON_MAX_ARITY, <boost/python/args.hpp>, 1 )
50+ # include BOOST_PP_ITERATE()
51+
52+ # define BOOST_PP_ITERATION_PARAMS_1 4 , (0 , BOOST_PYTHON_MAX_ARITY - 1 , <boost/python/args.hpp>, 2 )
53+ # include BOOST_PP_ITERATE()
54+
55+
56+ }} // namespace boost::mpl
57+
58+ # endif // __EDG_VERSION__
59+
60+ # endif // ARGS_DWA2002323_HPP
61+
62+ /* ---------- size ---------- */
63+ #elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == 1
64+ # line BOOST_PP_LINE(__LINE__, args.hpp(size))
65+
66+ # define N BOOST_PP_ITERATION ()
67+
68+ template <BOOST_PYTHON_UNARY_ENUM(N, class A )>
69+ struct size<boost::python::args<BOOST_PYTHON_UNARY_ENUM(N, A)> >
70+ {
71+ BOOST_STATIC_CONSTANT (long , value = N);
72+ };
73+
74+ # undef N
75+
76+ /* ---------- at ---------- */
77+ #elif BOOST_PP_ITERATION_DEPTH() == 1 && BOOST_PP_ITERATION_FLAGS() == 2
78+ # line BOOST_PP_LINE(__LINE__, args.hpp(at))
79+
80+ # define N BOOST_PP_ITERATION ()
81+
82+ template <BOOST_PYTHON_UNARY_ENUM(BOOST_PYTHON_MAX_ARITY, class A )>
83+ struct at<N, boost::python::args<BOOST_PYTHON_UNARY_ENUM(BOOST_PYTHON_MAX_ARITY, A)> >
84+ {
85+ typedef BOOST_PP_CAT (A, N) type;
86+ };
87+
88+ # undef N
89+
90+ #endif
0 commit comments