On 06/23/2009 02:59 PM, Simon Pickles wrote:

When I use code which parallels this structure, I see the Model destructor is called when the c++ object goes out of scope (fine) despite the object being passed to python as the argument of a function (not fine!)

That is because by default arguments are passed by-value. If you want something else, you need to specify a return-value policy, such as manage_new_object.



Is there a return policy I need to provide? I am confused by the way the destructing class is new'ed in c++ code, not in python by using exposed c++.

boost.python wants to pass a Model, and thus makes a copy. from the object you pass back, then destructs it.

Regards,
        Stefan


--

      ...ich hab' noch einen Koffer in Berlin...

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to