[C++-sig] Custodian & ward

Niall Douglas s_sourceforge at nedprod.com
Sat Jun 11 16:03:25 CEST 2005


On 11 Jun 2005 at 8:47, Jarno Seppänen wrote:

> The LLVM library (and Niall's FXWindow library IIUC) semantics are
> that the child object constructor transfers the ownership of itself to
> the parent, and the child object must _not_ be deleted, because the
> parent owns it.  At the same time the semantics guarantee that the
> child object is not deleted before the parent is, i.e., use for
> with_custodian_and_ward, no?

I did get custodian & ward to prevent *python* deleting either the 
parent before the child or the child before the parent, but that's 
not what I want to do. I *fully* want python to be able to delete 
either at any time with immediate effect so it became clear that 
custodian & ward is of no use to me.

What I do have a problem with is the C++ library deleting stuff 
without telling python. There isn't much I can do to stop that, but I 
can tell python somehow to permanently forget about those instances.

Cheers,
Niall






More information about the Cplusplus-sig mailing list