Boost logo

Boost :

Subject: Re: [boost] How to make a soft copy of a temporary Python object inside C++
From: Dave Abrahams (dave_at_[hidden])
Date: 2010-12-07 11:21:46


On Tue, Dec 7, 2010 at 9:06 AM, Raul Durand <raul.durand_at_[hidden]> wrote:
> So, how can I avoid Python for destroying the temporary and keep the object
> alive in C++?
> Does it have anything to do with the object ownership? Is there a way to
> change the ownership?

See with_custodian_and_ward in the docs:
http://www.boost.org/doc/libs/1_45_0/libs/python/doc/tutorial/doc/html/python/functions.html#python.call_policies

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

HTH,

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk