Boost logo

Boost :

Subject: Re: [boost] double_ended - request formal review
From: Thorsten Ottosen (tottosen_at_[hidden])
Date: 2016-08-23 05:05:36

On 26-07-2016 23:00, Mathias Gaunard wrote:
> On 24 July 2016 at 14:44, Benedek Thaler <thalerbenedek_at_[hidden]> wrote:
>> 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 think it's pretty serious. Consider:
> int n;
> devector<int> d;
> d.push_back(0);
> for(int i=0; i<n; ++i)
> {
> d.push_back(i);
> d.pop_front();
> }
> You end up with ever growing memory consumption, despite the devector only
> containing one or two elements at all times.


There are arguments for either behavior. devector is modelled after
vector, and so it tries to do it like a vector does. And vector doesn't
change the capacaity with pop_back(). It's not a circular queue either,
and never can be because it promises that the [begin,end) range is one

Anyway, Benedek needs a review manager. I could do it, but I think it
should not be me as I was his GSOC mentor.

kind regards


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