I will explain this more.
First I have a c++ class like this: struct object { object(object *parent=0) // if parent !=NULL append this at parent children list ~object() //Destroy all children }; Is possible implement this using "python::with_custodian_and_ward_postcall"? I tried some like that: qclass_<object_wrapper, boost::noncopyable > ("object", python::init<> ()) //here i put self will be the ward and arg 2 (parent) will be the custodian or .def(python::init<object*>()[python::with_custodian_and_ward_postcall<2,1>()]) On Mon, Nov 3, 2008 at 12:48 PM, Renato Araujo <[EMAIL PROTECTED]> wrote: > Hi all, > > Im trying create a binding for the flowing example: > > C++ > ======== > > struct object > { > object(object *parent); > }; > > when the object parent is destroyed then all children will be destroyed too. > > > How I can solve this with boost::python? > > I'm trying in this way: > > object_wrapper* _ojbect_constructor(object_wrapper* parent) > { > return new object_wrapper(parent); > } > > qclass_<object_wrapper, boost::noncopyable>("MyObject", > python::no_init) .def("__init__", > python::make_constructor(_ojbect_wrapper_constructor, > python::with_custodian_and_ward_postcall<0, 1>())) > > > But this not compile, because the "with_custodian_and_ward" need a > function with 2 args like (self, parent) how can I solve this problem? > > -- Renato Araujo Oliveira Filho _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig