]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // Copyright David Abrahams 2002. |
2 | // Distributed under the Boost Software License, Version 1.0. (See | |
3 | // accompanying file LICENSE_1_0.txt or copy at | |
4 | // http://www.boost.org/LICENSE_1_0.txt) | |
5 | #ifndef BASES_DWA2002321_HPP | |
6 | # define BASES_DWA2002321_HPP | |
7 | ||
8 | # include <boost/python/detail/prefix.hpp> | |
9 | # include <boost/type_traits/object_traits.hpp> | |
10 | # include <boost/python/detail/type_list.hpp> | |
11 | # include <boost/mpl/if.hpp> | |
12 | # include <boost/mpl/bool.hpp> | |
13 | # include <boost/preprocessor/enum_params_with_a_default.hpp> | |
14 | # include <boost/preprocessor/enum_params.hpp> | |
15 | ||
16 | namespace boost { namespace python { | |
17 | ||
18 | # define BOOST_PYTHON_BASE_PARAMS BOOST_PP_ENUM_PARAMS_Z(1, BOOST_PYTHON_MAX_BASES, Base) | |
19 | ||
20 | // A type list for specifying bases | |
21 | template < BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(BOOST_PYTHON_MAX_BASES, typename Base, mpl::void_) > | |
22 | struct bases : detail::type_list< BOOST_PYTHON_BASE_PARAMS >::type | |
23 | {}; | |
24 | ||
25 | namespace detail | |
26 | { | |
27 | template <class T> struct specifies_bases | |
28 | : mpl::false_ | |
29 | { | |
30 | }; | |
31 | ||
32 | template < BOOST_PP_ENUM_PARAMS_Z(1, BOOST_PYTHON_MAX_BASES, class Base) > | |
33 | struct specifies_bases< bases< BOOST_PYTHON_BASE_PARAMS > > | |
34 | : mpl::true_ | |
35 | { | |
36 | }; | |
37 | template <class T, class Prev = bases<> > | |
38 | struct select_bases | |
39 | : mpl::if_< | |
40 | specifies_bases<T> | |
41 | , T | |
42 | , Prev | |
43 | > | |
44 | { | |
45 | }; | |
46 | } | |
47 | # undef BOOST_PYTHON_BASE_PARAMS | |
48 | }} // namespace boost::python | |
49 | ||
50 | #endif // BASES_DWA2002321_HPP |