I think what you want is the with_custodian_and_ward CallPolicy:

http://www.boost.org/doc/libs/1_55_0/libs/python/doc/v2/with_custodian_and_ward.html

I can never remember the details of how to invoke it, so I don't have an
example ready to go that solves your specific problem, but hopefully the
docs above will point you in the right direction.

As Neal said, if you can afford to change your C++ code, it's probably
cleaner and easier to use boost::shared_ptr, but you should still be able
to get what you want with CallPolicies even if you can't.

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

Reply via email to