[29] | 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 | #include <boost/python/bases.hpp> |
---|
| 6 | #include <boost/static_assert.hpp> |
---|
| 7 | #include <boost/type_traits/same_traits.hpp> |
---|
| 8 | |
---|
| 9 | struct A; |
---|
| 10 | struct B; |
---|
| 11 | |
---|
| 12 | template <class X, class Y, class Z> |
---|
| 13 | struct choose_bases |
---|
| 14 | : boost::python::detail::select_bases< |
---|
| 15 | X |
---|
| 16 | , typename boost::python::detail::select_bases< |
---|
| 17 | Y |
---|
| 18 | , typename boost::python::detail::select_bases<Z>::type |
---|
| 19 | >::type> |
---|
| 20 | { |
---|
| 21 | |
---|
| 22 | }; |
---|
| 23 | |
---|
| 24 | int main() |
---|
| 25 | { |
---|
| 26 | BOOST_STATIC_ASSERT((boost::python::detail::specifies_bases< |
---|
| 27 | boost::python::bases<A,B> >::value)); |
---|
| 28 | |
---|
| 29 | BOOST_STATIC_ASSERT((!boost::python::detail::specifies_bases< |
---|
| 30 | boost::python::bases<A,B>& >::value)); |
---|
| 31 | |
---|
| 32 | BOOST_STATIC_ASSERT((!boost::python::detail::specifies_bases< |
---|
| 33 | void* >::value)); |
---|
| 34 | |
---|
| 35 | BOOST_STATIC_ASSERT((!boost::python::detail::specifies_bases< |
---|
| 36 | int >::value)); |
---|
| 37 | |
---|
| 38 | BOOST_STATIC_ASSERT((!boost::python::detail::specifies_bases< |
---|
| 39 | int[5] >::value)); |
---|
| 40 | |
---|
| 41 | typedef boost::python::detail::select_bases< |
---|
| 42 | int |
---|
| 43 | , boost::python::detail::select_bases<char*>::type > collected1; |
---|
| 44 | |
---|
| 45 | BOOST_STATIC_ASSERT((boost::is_same<collected1::type,boost::python::bases<> >::value)); |
---|
| 46 | BOOST_STATIC_ASSERT((boost::is_same<choose_bases<int,char*,long>::type,boost::python::bases<> >::value)); |
---|
| 47 | |
---|
| 48 | typedef boost::python::detail::select_bases< |
---|
| 49 | int |
---|
| 50 | , boost::python::detail::select_bases< |
---|
| 51 | boost::python::bases<A,B> |
---|
| 52 | , boost::python::detail::select_bases< |
---|
| 53 | A |
---|
| 54 | >::type |
---|
| 55 | >::type |
---|
| 56 | > collected2; |
---|
| 57 | |
---|
| 58 | BOOST_STATIC_ASSERT((boost::is_same<collected2::type,boost::python::bases<A,B> >::value)); |
---|
| 59 | BOOST_STATIC_ASSERT((boost::is_same<choose_bases<int,boost::python::bases<A,B>,long>::type,boost::python::bases<A,B> >::value)); |
---|
| 60 | |
---|
| 61 | return 0; |
---|
| 62 | } |
---|