Boost logo

Boost :

Subject: Re: [boost] [GSOC] Regarding the project Boost.DeVector
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2009-03-29 08:30:35


Esben Mose Hansen skrev:
> On Friday 27 March 2009 20:02:41 Satyam Shekhar wrote:
>> b. Why isn't the reserve function already there in a deque?
>> Assuming there is a [use] valid case for this function, adding it shouldn't
>> be too difficult. Allocate a block(s) and add the address to the
>> top-level array.
>
> I'm pretty sure the assumption "there is a valid [use] case" is false.
>
> reserve() is in vector so that clients can control when a possible complete
> realloc+move is going to happen, and possibly even avoid it altogether. This
> is important for a lot of reasons, including that all iterators get
> invalidated. For deque, new blocks are simply allocated as needed and the
> existing blocks are never reallocated. Thus, there would be little point with
> preallocating the array.

Please see my other post.

-Thorsten


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