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/object/class_metadata.hpp>
6 #include <boost/python/has_back_reference.hpp>
7 #include <boost/python/detail/not_specified.hpp>
8 #include <boost/static_assert.hpp>
9 #include <boost/type_traits/same_traits.hpp>
10 #include <boost/function/function0.hpp>
11 #include <boost/mpl/bool.hpp>
17 struct Derived
: Base
{};
19 namespace boost
{ namespace python
23 struct has_back_reference
<BR
>
27 }} // namespace boost::python
29 template <class T
, class U
>
30 void assert_same(U
* = 0, T
* = 0)
32 BOOST_STATIC_ASSERT((boost::is_same
<T
,U
>::value
));
36 template <class T
, class Held
, class Holder
>
37 void assert_holder(T
* = 0, Held
* = 0, Holder
* = 0)
39 using namespace boost::python::detail
;
40 using namespace boost::python::objects
;
42 typedef typename class_metadata
<
43 T
,Held
,not_specified
,not_specified
51 int test_main(int, char * [])
53 using namespace boost::python::detail
;
54 using namespace boost::python::objects
;
56 assert_holder
<Base
,not_specified
,value_holder
<Base
> >();
58 assert_holder
<BR
,not_specified
,value_holder_back_reference
<BR
,BR
> >();
59 assert_holder
<Base
,Base
,value_holder_back_reference
<Base
,Base
> >();
60 assert_holder
<BR
,BR
,value_holder_back_reference
<BR
,BR
> >();
62 assert_holder
<Base
,Derived
63 ,value_holder_back_reference
<Base
,Derived
> >();
65 assert_holder
<Base
,std::auto_ptr
<Base
>
66 ,pointer_holder
<std::auto_ptr
<Base
>,Base
> >();
68 assert_holder
<Base
,std::auto_ptr
<Derived
>
69 ,pointer_holder_back_reference
<std::auto_ptr
<Derived
>,Base
> >();
71 assert_holder
<BR
,std::auto_ptr
<BR
>
72 ,pointer_holder_back_reference
<std::auto_ptr
<BR
>,BR
> > ();