[C++-sig] bpl v2: changing ownership of c++ objects

Peter Schoen Peter.Schoen1 at epost.de
Thu Aug 22 01:23:02 CEST 2002


Dear y'all,

I am currently trying to wrap a Tree/Graph-API using Boost.Python v2. It's my 
goal to embed the Python interpreter into the main application to let the user 
assemble and change the tree/graph interactively using Python. The user 
should be able to create nodes and add them to the graph.

Problem: Each node of the graph has a:

	void Node::addChild(Node* child);

method. Once a child node or a subtree is added using this method, 
the father node becomes responsible for the life-cycle management of its 
children. No Python reference counting should interfere from this moment on. 
Even if the Python wrapper objects are destroyed, the subtree should still 
live on.

Is there a way to do this in Boost.Python v2? Is with_custodian_and_ward<> a 
means to do this?

Thanks & very best wishes

-Peter-






More information about the Cplusplus-sig mailing list