[C++-sig] Re: Call Policy Question
mike.spam.filter at day8.com.au
Sun Nov 14 11:31:09 CET 2004
David Abrahams wrote:
> Mike Thompson <mike.spam.filter at day8.com.au> writes:
>>I have a member function which returns an object and I'm trying to
>>define a call policy for that member function which will:
>> 1. cause the returned object to be managed:
>> its a new object and needs to be managed.
>> 2. register that the returned object holds a
>> reference to the originating object (but not visa-versa)
>>but I can't work out how to combine the two.
>>I need 1. above because the returned object is new and needs to be managed.
>>I need 2. above because this returned object has references BACK
>>to the object who's member function supplies it.
>>So the returned object can be destroyed without the original being
>>effected, but destruction of the original MUST wait until the returned
>>object is gone.
> , with_custodian_and_ward<0, 1>
> should work.
Ahh. Of course. Thanks.
But, just to be clear, I suspect you meant to use
More information about the Cplusplus-sig