Skip to content

Commit a75ee50

Browse files
committed
Removed def_init(...) from class_
[SVN r15468]
1 parent 8e94141 commit a75ee50

File tree

2 files changed

+14
-39
lines changed

2 files changed

+14
-39
lines changed

include/boost/python/class.hpp

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ template <
102102
>
103103
class class_ : public objects::class_base
104104
{
105-
private: // types
105+
public: // types
106106
typedef objects::class_base base;
107107

108108
typedef class_<T,X1,X2,X3> self;
@@ -116,12 +116,15 @@ class class_ : public objects::class_base
116116

117117
typedef objects::select_holder<T,held_type> holder_selector;
118118

119+
private:
120+
119121
typedef typename detail::select_bases<X1
120122
, typename detail::select_bases<X2
121123
, typename boost::python::detail::select_bases<X3>::type
122124
>::type
123125
>::type bases;
124126

127+
125128
// A helper class which will contain an array of id objects to be
126129
// passed to the base class constructor
127130
struct id_vector
@@ -223,42 +226,6 @@ class class_ : public objects::class_base
223226
return this->def(op.name(), &op_t::template apply<T>::execute);
224227
}
225228

226-
// Define the constructor with the given Args, which should be an
227-
// MPL sequence of types.
228-
template <class Args>
229-
self& def_init(Args const&)
230-
{
231-
return this->def("__init__",
232-
python::make_constructor<Args>(
233-
// Using runtime type selection works around a CWPro7 bug.
234-
holder_selector::execute((held_type*)0).get()
235-
)
236-
);
237-
}
238-
239-
template <class Args, class CallPolicyOrDoc>
240-
self& def_init(Args const&, CallPolicyOrDoc const& policy_or_doc, char const* doc = 0)
241-
{
242-
typedef detail::def_helper<CallPolicyOrDoc> helper;
243-
244-
return this->def(
245-
"__init__",
246-
python::make_constructor<Args>(
247-
helper::get_policy(policy_or_doc)
248-
// Using runtime type selection works around a CWPro7 bug.
249-
, holder_selector::execute((held_type*)0).get()
250-
)
251-
, helper::get_doc(policy_or_doc, doc)
252-
);
253-
}
254-
255-
// Define the default constructor.
256-
self& def_init()
257-
{
258-
this->def_init(mpl::list0<>::type());
259-
return *this;
260-
}
261-
262229
//
263230
// Data member access
264231
//
@@ -400,7 +367,7 @@ inline class_<T,X1,X2,X3>::class_(char const* name, char const* doc)
400367
{
401368
this->register_();
402369
detail::force_instantiate(sizeof(detail::assert_default_constructible(T())));
403-
this->def_init();
370+
this->def(init<>());
404371
this->set_instance_size(holder_selector::additional_size());
405372
}
406373

include/boost/python/init.hpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,15 @@ namespace detail
269269
, mpl::push_front<>
270270
>::type args;
271271

272-
cl.def_init(args(), policies, doc);
272+
cl.def(
273+
"__init__",
274+
python::make_constructor<args>(
275+
policies
276+
// Using runtime type selection works around a CWPro7 bug.
277+
, ClassT::holder_selector::execute((ClassT::held_type*)0).get()
278+
)
279+
, doc
280+
);
273281
}
274282

275283
///////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)