[C++-sig] with_custodian_and_ward clarification

Stefan Seefeld stefan.seefeld at orthosoft.ca
Wed Feb 11 16:33:34 CET 2004


hi there,

I want to call a function that connects one object ('slave')
to another ('master'). Looking through the documentation for
the possible call policies, my best guess is to use
'with_custodian_and_ward'.

void connect(Slave *s, Master *m) { s->connect(m);}

...

def("connect",
     make_function(connect, with_custodian_and_ward<1, 2>()));


The docs say the lifetime of '2' is thus tied to the lifetime
of '1'. I'm *guessing* it means that '2' will *at least* live
as long as '1'. Is that correct ? (The docs could be a bit more
explicit about that)

Thanks,
		Stefan





More information about the Cplusplus-sig mailing list