From: Stefan Z. <sz...@gm...> - 2011-08-22 05:54:11
|
On Fri, Aug 12, 2011 at 10:12 PM, Zvi Tarem <zvi...@gm...> wrote: > I have a C++ container class that takes ownership of objects that are > inserted into it (that is - the container deletes the contained objects when > it is destructed). > Before --builtin, the following line worked: > %pythonprepend Container::insert { args[0].thisown = False } > With --builtin, there is no shadow class to modify. > In principle, if there was a way to refer to wrapped versions of classes in > %extend, for example, this could be done because wrapped versions of classes > have the thisown property, as well as the disown() method. I think you can accomplish this with the DISOWN typemap: %apply SWIGTYPE *DISOWN { MyObject *obj_to_insert }; Make sure that the %apply directive is applied only to the Container::insert method. Stefan |