passig lifetime control to C++
mike at bindkey.com
Mon Jan 20 22:19:38 CET 2003
"jochen" <jochen.heckl at novatrix.de> wrote in message
news:8de825c2.0301200859.4b89cee3 at posting.google.com...
> I have class EventQueue that takes control over the lifetime of Events
> that are passed to it. Now I wan't to export this functionality to
> python using boost_python.
It's better to ask boost_python questions in c++-sig mailing list.
> int EventQueue::PostEvent( Event* i_pEvent )
> to python, how do I keep Python from deleting the Event after the
> script has finished? Can this be done with call policies ?
By default it will create new Event object with Event(*i_pEvent), so you can
If you expose it as
.def("PostEvent", &EventQueue::PostEvent, with_custodian_and_ward<1,2>())
then Event will not be deleted while EventQueue is alive.
More information about the Python-list