[C++-sig] Contructor with "with_custodian_and_ward_postcall"

Renato Araujo renatox at gmail.com
Mon Nov 3 16:48:45 CET 2008


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


More information about the Cplusplus-sig mailing list