On Thu, Jul 21, 2016 at 4:59 PM, Mathias Gaunard < mathias.gaunard@ens-lyon.org> wrote:
On 15 July 2016 at 16:51, Benedek Thaler
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