On 8/13/2015 4:26 AM, MM wrote:
What I want to express is:
The t returned by the python function should refer to object T held in
c++ memory, and for instance
del t
should not delete the actual T object in c++ memory
Should I still use "return_internal_reference" ?
You can use reference_existing_object
(http://www.boost.org/doc/libs/1_59_0/libs/python/doc/v2/reference_existing_object.html)
But as the docs say, that can be dangerous since if I do 't = get_T()'
in python and then sometime later C++ deletes the object that t refers
to, now I have a dangling pointer. If I try to use 't' in python now I
have undefined behavior (and likely crash).
Alex
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
https://mail.python.org/mailman/listinfo/cplusplus-sig