Boost logo

Boost :

Subject: Re: [boost] [ptr_container] Questionable strong guarantee of ptr_map::insert()
From: Kazutoshi Satoda (k_satoda_at_[hidden])
Date: 2009-08-25 10:38:43

Thorsten Ottosen wrote:
>>> Hm. Do you propose to break the existing interface?
>> Yes, I personally believe that the following use should be banned by
>> design.
>>>> map.insert(some_key(...), std::auto_ptr<value>(new value));
>> 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.

Hmm, I didn't think of such code. I agree such code is valid and safe.

However, as far as I know, there is no way to distinguish the two; a
temporary auto_ptr, and a returned auto_ptr. Then the interface can
allow both, or disallow both. I still think the latter is better choice
in a generic library.

Do you think passing a temporary auto_ptr should be allowed to allow
passing a returned auto_ptr?


Boost list run by bdawes at, gregod at, cpdaniel at, john at