Boost logo

Boost :

Subject: Re: [boost] [ptr_container] Questionable strong guarantee of ptr_map::insert()
From: Edward Diener (eldiener_at_[hidden])
Date: 2009-08-24 23:22:12


Nevin ":-]" Liber wrote:
> 2009/8/24 Thorsten Ottosen <thorsten.ottosen_at_[hidden]>
>
>> I want to hear about some compatibility policy in Boost to guess the
>>> possibility of this kind of breaking (but otherwise good) changes.
>>>
>> Well, you also break perfectly valid and safe code where the auto pointer
>> is returned from a function.
>
>
> While it is a breaking change, it is a compile-time breaking change with a
> very easy fix for the caller (they pass FunctionReturningAutoPtr().release()
> instead of FunctionReturningAutoPtr()). And it isn't like the library
> hasn't had breaking changes before (the iterators had changed). Currently,
> the semantics are surprising (they certainly are to me); I believe that most
> people expect that if they pass an auto_ptr and an exception is thrown, then
> the auto_ptr has not relinquished ownership. Otherwise, why bother with an
> auto_ptr at all?

I would have assumed that if I pass an auto_ptr that ownership is
relinquished no matter what happens later, exception or not. Is not that
how the copy constructor of an auto_ptr is supposed to work ?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk