|
Boost Users : |
From: Boris (boriss_at_[hidden])
Date: 2007-09-24 09:39:20
On Mon, 24 Sep 2007 11:06:06 +0300, Thorsten Ottosen
<thorsten.ottosen_at_[hidden]> wrote:
> Boris skrev:
>> struct foo { };
>> boost::ptr_map<int, foo> bar;
>> bar.insert(1, new foo());
>> bar.insert(1, new foo());
>>
>> Does this code leak? Or does bar delete the second instance of foo?
>
> The containers never leak. (If so, it is a bug).
I asked as it wasn't clear to me if the container takes responsibility for
deleting the second instance as after all it isn't stored in the
container. I understand now that the code is safe though. Thanks for your
reply!
Boris
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net