|
| 1 | +/////////////////////////////////////////////////////////////////////////////// |
| 2 | +// |
| 3 | +// Copyright David Abrahams 2002. Permission to copy, use, |
| 4 | +// modify, sell and distribute this software is granted provided this |
| 5 | +// copyright notice appears in all copies. This software is provided |
| 6 | +// "as is" without express or implied warranty, and with no claim as |
| 7 | +// to its suitability for any purpose. |
| 8 | +// |
| 9 | +/////////////////////////////////////////////////////////////////////////////// |
| 10 | +#if !defined(BOOST_PP_IS_ITERATING) |
| 11 | + |
| 12 | +#ifndef TYPE_LIST_UTILS_JDG20020826_HPP |
| 13 | +#define TYPE_LIST_UTILS_JDG20020826_HPP |
| 14 | + |
| 15 | +# include <boost/mpl/at.hpp> |
| 16 | +# include <boost/mpl/size.hpp> |
| 17 | +//# include <boost/mpl/pop_front.hpp> |
| 18 | +//# include <boost/mpl/pop_back.hpp> |
| 19 | + |
| 20 | +# include <boost/preprocessor/enum_params.hpp> |
| 21 | +# include <boost/preprocessor/enum_shifted_params.hpp> |
| 22 | +# include <boost/preprocessor/cat.hpp> |
| 23 | +# include <boost/preprocessor/iterate.hpp> |
| 24 | +# include <boost/preprocessor/dec.hpp> |
| 25 | + |
| 26 | +namespace boost { namespace python { namespace detail { |
| 27 | + |
| 28 | +# if (!defined(__EDG_VERSION__) || __EDG_VERSION__ > 245) \ |
| 29 | + && (!defined(BOOST_INTEL_CXX_VERSION) || BOOST_INTEL_CXX_VERSION > 600) |
| 30 | + |
| 31 | + template <int N, class L> |
| 32 | + struct type_at : public boost::mpl::at<N, L> {}; |
| 33 | + |
| 34 | + template <class L> |
| 35 | + struct type_list_size : public boost::mpl::size<L> {}; |
| 36 | + |
| 37 | +// template <class L> |
| 38 | +// struct pop_front : public boost::mpl::pop_front<L> {}; |
| 39 | +// |
| 40 | +// template <class L> |
| 41 | +// struct pop_back : public boost::mpl::pop_back<L> {}; |
| 42 | + |
| 43 | +# else |
| 44 | + |
| 45 | + template <int N, class L> |
| 46 | + struct type_at {}; |
| 47 | + |
| 48 | + template <class L> |
| 49 | + struct type_list_size {}; |
| 50 | + |
| 51 | +// template <class L> |
| 52 | +// struct pop_front {}; |
| 53 | +// |
| 54 | +// template <class L> |
| 55 | +// struct pop_back {}; |
| 56 | + |
| 57 | +// template <class L, class T> |
| 58 | +// struct push_back {}; |
| 59 | + |
| 60 | +# define BOOST_PP_ITERATION_PARAMS_1 \ |
| 61 | + (3, (0, BOOST_PYTHON_MAX_ARITY, <boost/python/detail/type_list_utils.hpp>)) |
| 62 | +# include BOOST_PP_ITERATE() |
| 63 | + |
| 64 | +# endif |
| 65 | + |
| 66 | +}}} // namespace boost::python::detail |
| 67 | + |
| 68 | +#endif // TYPE_LIST_UTILS_JDG20020826_HPP |
| 69 | + |
| 70 | +#else // defined(BOOST_PP_IS_ITERATING) |
| 71 | + |
| 72 | +# define N BOOST_PP_ITERATION() |
| 73 | +# define MAX BOOST_PYTHON_MAX_ARITY |
| 74 | + |
| 75 | +# if (N < MAX-1) |
| 76 | + |
| 77 | + template <BOOST_PP_ENUM_PARAMS(MAX, class A)> |
| 78 | + struct type_at<N, boost::mpl::type_list<BOOST_PP_ENUM_PARAMS(MAX, A)> > |
| 79 | + { |
| 80 | + typedef BOOST_PP_CAT(A, N) type; |
| 81 | + }; |
| 82 | + |
| 83 | +// template <BOOST_PP_ENUM_PARAMS(N, class A) BOOST_PP_COMMA_IF(N) class T> |
| 84 | +// struct push_back<boost::mpl::type_list<BOOST_PP_ENUM_PARAMS(N, A)>, T> |
| 85 | +// { |
| 86 | +// typedef boost::mpl::type_list<BOOST_PP_ENUM_PARAMS(N, A) BOOST_PP_COMMA_IF(N) T> sequence; |
| 87 | +// }; |
| 88 | + |
| 89 | +# if (N > 0) |
| 90 | + |
| 91 | +// template <BOOST_PP_ENUM_PARAMS(N, class A)> |
| 92 | +// struct pop_front<boost::mpl::type_list<BOOST_PP_ENUM_PARAMS(N, A)> > |
| 93 | +// { |
| 94 | +// typedef boost::mpl::type_list<BOOST_PP_ENUM_SHIFTED_PARAMS(N, A)> sequence; |
| 95 | +// }; |
| 96 | +// |
| 97 | +// template <BOOST_PP_ENUM_PARAMS(N, class A)> |
| 98 | +// struct pop_back<boost::mpl::type_list<BOOST_PP_ENUM_PARAMS(N, A)> > |
| 99 | +// { |
| 100 | +// typedef boost::mpl::type_list<BOOST_PP_ENUM_PARAMS(BOOST_PP_DEC(N), A)> sequence; |
| 101 | +// }; |
| 102 | + |
| 103 | +# endif |
| 104 | +# endif |
| 105 | + |
| 106 | + template <BOOST_PP_ENUM_PARAMS(N, class A)> |
| 107 | + struct type_list_size<boost::mpl::type_list<BOOST_PP_ENUM_PARAMS(N, A)> > |
| 108 | + { |
| 109 | + BOOST_STATIC_CONSTANT(long, value = N); |
| 110 | + }; |
| 111 | + |
| 112 | +# undef N |
| 113 | +# undef MAX |
| 114 | + |
| 115 | +#endif // !defined(BOOST_PP_IS_ITERATING) |
0 commit comments