2121# include < boost/mpl/bool_t.hpp>
2222# include < boost/python/object/select_holder.hpp>
2323# include < boost/python/object/class_wrapper.hpp>
24+ # include < boost/python/object/make_instance.hpp>
2425# include < boost/python/data_members.hpp>
2526# include < boost/utility.hpp>
2627# include < boost/python/detail/operator_id.hpp>
@@ -56,7 +57,7 @@ namespace detail
5657 static inline void register_copy_constructor (mpl::bool_t <true > const &, SelectHolder const & , T* = 0 )
5758 {
5859 typedef typename SelectHolder::type holder;
59- force_instantiate (objects::class_wrapper<T,holder>());
60+ force_instantiate (objects::class_wrapper<T,holder, objects::make_instance<T,holder> >());
6061 SelectHolder::register_ ();
6162 }
6263
@@ -96,7 +97,7 @@ class class_ : public objects::class_base
9697 X3
9798 >::type>::type>::type held_type;
9899
99- typedef objects::class_id class_id ;
100+ typedef objects::select_holder<T,held_type> holder_selector ;
100101
101102 typedef typename detail::select_bases<X1
102103 , typename detail::select_bases<X2
@@ -108,20 +109,19 @@ class class_ : public objects::class_base
108109 // passed to the base class constructor
109110 struct id_vector
110111 {
111- typedef objects::class_id class_id;
112112 id_vector ()
113113 {
114114 // Stick the derived class id into the first element of the array
115115 ids[0 ] = type_id<T>();
116116
117117 // Write the rest of the elements into succeeding positions.
118- class_id * p = ids + 1 ;
118+ type_info * p = ids + 1 ;
119119 mpl::for_each<bases, void , detail::write_type_id>::execute (&p);
120120 }
121121
122122 BOOST_STATIC_CONSTANT (
123123 std::size_t , size = mpl::size<bases>::value + 1 );
124- class_id ids[size];
124+ type_info ids[size];
125125 };
126126 friend struct id_vector ;
127127
@@ -146,6 +146,7 @@ class class_ : public objects::class_base
146146 {
147147 this ->register_ ();
148148 this ->def_init (InitArgs ());
149+ this ->set_instance_size (holder_selector::additional_size ());
149150 }
150151
151152
@@ -155,6 +156,7 @@ class class_ : public objects::class_base
155156 {
156157 this ->register_ ();
157158 this ->def_init (InitArgs (), initdoc);
159+ this ->set_instance_size (holder_selector::additional_size ());
158160 }
159161
160162 // Wrap a member function or a non-member function which can take
@@ -237,7 +239,7 @@ class class_ : public objects::class_base
237239 return this ->def (" __init__" ,
238240 python::make_constructor<Args>(
239241 // Using runtime type selection works around a CWPro7 bug.
240- objects::select_holder<T,held_type> ((held_type*)0 ).get ()
242+ holder_selector::execute ((held_type*)0 ).get ()
241243 )
242244 );
243245 }
@@ -252,7 +254,7 @@ class class_ : public objects::class_base
252254 python::make_constructor<Args>(
253255 helper::get_policy (policy_or_doc)
254256 // Using runtime type selection works around a CWPro7 bug.
255- , objects::select_holder<T,held_type> ((held_type*)0 ).get ()
257+ , holder_selector::execute ((held_type*)0 ).get ()
256258 )
257259 , helper::get_doc (policy_or_doc, doc)
258260 );
@@ -389,7 +391,7 @@ inline void class_<T,X1,X2,X3>::register_() const
389391
390392 detail::register_copy_constructor<T>(
391393 mpl::bool_t <is_copyable>()
392- , objects::select_holder<T,held_type> ((held_type*)0 )
394+ , holder_selector::execute ((held_type*)0 )
393395 );
394396}
395397
@@ -402,6 +404,7 @@ inline class_<T,X1,X2,X3>::class_()
402404 this ->register_ ();
403405 detail::force_instantiate (sizeof (detail::assert_default_constructible (T ())));
404406 this ->def_init ();
407+ this ->set_instance_size (holder_selector::additional_size ());
405408}
406409
407410template <class T , class X1 , class X2 , class X3 >
@@ -419,6 +422,7 @@ inline class_<T,X1,X2,X3>::class_(char const* name, char const* doc)
419422 this ->register_ ();
420423 detail::force_instantiate (sizeof (detail::assert_default_constructible (T ())));
421424 this ->def_init ();
425+ this ->set_instance_size (holder_selector::additional_size ());
422426}
423427
424428template <class T , class X1 , class X2 , class X3 >
0 commit comments