|
20 | 20 | # include <boost/python/init.hpp> |
21 | 21 | # include <boost/python/args_fwd.hpp> |
22 | 22 |
|
23 | | -# include <boost/type_traits/is_same.hpp> |
24 | | -# include <boost/type_traits/is_convertible.hpp> |
25 | | -# include <boost/type_traits/is_member_function_pointer.hpp> |
26 | | -# include <boost/type_traits/is_polymorphic.hpp> |
27 | | - |
28 | | -# include <boost/mpl/size.hpp> |
29 | | -# include <boost/mpl/for_each.hpp> |
30 | | -# include <boost/mpl/bool.hpp> |
31 | | -# include <boost/mpl/not.hpp> |
32 | | -# include <boost/mpl/or.hpp> |
33 | | - |
34 | 23 | # include <boost/python/object/select_holder.hpp> |
35 | 24 | # include <boost/python/object/class_wrapper.hpp> |
36 | 25 | # include <boost/python/object/make_instance.hpp> |
|
44 | 33 | # include <boost/python/detail/def_helper.hpp> |
45 | 34 | # include <boost/python/detail/force_instantiate.hpp> |
46 | 35 |
|
| 36 | +# include <boost/type_traits/is_same.hpp> |
| 37 | +# include <boost/type_traits/is_convertible.hpp> |
| 38 | +# include <boost/type_traits/is_member_function_pointer.hpp> |
| 39 | +# include <boost/type_traits/is_polymorphic.hpp> |
| 40 | + |
| 41 | +# include <boost/mpl/size.hpp> |
| 42 | +# include <boost/mpl/for_each.hpp> |
| 43 | +# include <boost/mpl/bool.hpp> |
| 44 | +# include <boost/mpl/not.hpp> |
| 45 | +# include <boost/mpl/or.hpp> |
| 46 | +# include <boost/mpl/vector/vector10.hpp> |
| 47 | + |
47 | 48 | # include <boost/utility.hpp> |
48 | 49 | # include <boost/detail/workaround.hpp> |
49 | 50 |
|
@@ -106,6 +107,27 @@ namespace detail |
106 | 107 | SelectHolder::register_(); |
107 | 108 | } |
108 | 109 |
|
| 110 | + // |
| 111 | + // register_wrapper_class -- register the relationship between a |
| 112 | + // virtual function callback wrapper class and the class being |
| 113 | + // wrapped. |
| 114 | + // |
| 115 | + template <class T> |
| 116 | + inline void register_wrapper_class(T*, T*, int) {} |
| 117 | + |
| 118 | + template <class Wrapper, class T> |
| 119 | + inline void register_wrapper_class(Wrapper*, T*, ...) |
| 120 | + { |
| 121 | + objects::register_class_from_python<Wrapper, mpl::vector1<T> >(); |
| 122 | + objects::copy_class_object(type_id<T>(), type_id<Wrapper>()); |
| 123 | + } |
| 124 | + |
| 125 | + template <class Held, class T> |
| 126 | + inline void register_wrapper_class(Held* = 0, T* = 0) |
| 127 | + { |
| 128 | + register_wrapper_class((Held*)0, (T*)0, 0); |
| 129 | + } |
| 130 | + |
109 | 131 | # ifdef BOOST_PYTHON_NO_MEMBER_POINTER_ORDERING |
110 | 132 | template <class T> |
111 | 133 | struct is_data_member_pointer |
@@ -562,6 +584,12 @@ inline void class_<T,X1,X2,X3>::register_() const |
562 | 584 | { |
563 | 585 | objects::register_class_from_python<T,bases>(); |
564 | 586 |
|
| 587 | + typedef BOOST_DEDUCED_TYPENAME holder_selector::type select_holder; |
| 588 | + typedef BOOST_DEDUCED_TYPENAME select_holder::type holder; |
| 589 | + typedef BOOST_DEDUCED_TYPENAME holder::held_type held_t; |
| 590 | + |
| 591 | + detail::register_wrapper_class<held_t,T>(); |
| 592 | + |
565 | 593 | detail::register_class_to_python<T>( |
566 | 594 | mpl::bool_<is_copyable>() |
567 | 595 | # if BOOST_WORKAROUND(__MWERKS__, <= 0x2407) |
|
0 commit comments