Boost logo

Boost :

Subject: Re: [boost] double_ended - request formal review
From: Benedek Thaler (thalerbenedek_at_[hidden])
Date: 2016-07-24 09:44:55


On Thu, Jul 21, 2016 at 4:59 PM, Mathias Gaunard <
mathias.gaunard_at_[hidden]> wrote:

> On 15 July 2016 at 16:51, Benedek Thaler <thalerbenedek_at_[hidden]> wrote:
>
>
> devector is an interesting variant of vector, but it gives the illusion
> that is could be used as a queue.
> However given the implementation, it seems elements removed from either end
> will never be reclaimed.
>
> I suggest documenting that limitation or having a threshold above which
> memory is actually freed.
>
>
Thanks for the feedback, Mathias. You are right. This implementation detail
is a consequence of honoring reserve calls:

devector<int> d;
d.push_back(1);
d.reserve_front(100);
d.reserve_back(100);

The reserve back has to keep the front capacity untouched or it breaks the
promise of it. This also applies to a series of push_front/pop_backs, for
example.

I'll document this behavior. During the review, we'll see if we need more
radical changes, e.g: changing the guarantees of reserve calls.

Thanks,
Benedek


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