Boost logo

Boost :

Subject: Re: [boost] Proposal: Monotonic Containers
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2009-06-15 10:42:21


Christian Schladetsch skrev:
> On Mon, Jun 15, 2009 at 6:39 AM, Thorsten Ottosen <
> thorsten.ottosen_at_[hidden]> wrote:
>
>> Christian Schladetsch skrev:
>>
>>> Hi Thorsten,
>>>
>>> I have attempted to use boost::auto_buffer for monotonic::inline_storage.
>>>
>>> If a resize is required and the inline_storage is used by a contiguous
>>> container such as a std::vector, the resize breaks said container.
>>>
>> What particularly breaks the container?
>
>
> A resize that moves the storage for auto_buffer from the stack to the heap
> invalidates the pointers used by the vector.
>
>
>> And why do you want to use auto_buffer for inline_storage?
>
>
> It was suggested to me that auto_buffer and monotonic were doing similar
> things, and that I should investigate using auto_buffer for the storage to
> remove any redundancy.

I'm not sure why you use the container that way. Don't you normally
allocate everything at once? If so, then why don't you just do the same
with the auto_buffer? Again, unitialized_grow() might be useful.

-Thorsten


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