|
Boost : |
Subject: Re: [boost] Proposal: Monotonic Containers
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2009-06-15 17:08:02
Christian Schladetsch skrev:
>> boost::auto_buffer is usable like this via the function
>> unitialized_grow(C).
>
>
> Ahh right. I shall look into using auto_buffer for my chain and see if it
> can be resurrected in the general case. It will still be tricky, because
> IIRC auto_buffer doesn't span the stack/heap boundary? That is, it is either
> all on the stack, or all on the heap?
>
> The original motivation for chain (earlier 'rope') was to avoid resize, and
> to allow some of the links in the chain to be on the stack, and other links
> to be on the heap.
You're right that it is always either on the stack on on the heap.
That is the only way to support T* iterators.
OTOH, since you're only using it as a memory buffer, I see no reason why
you should not be able to hand out pointers to both spaces. The main
problem might be that is difficult to get the pointer to the stack
buffer after a resize, but the memory stays valid.
It wouldn't be hard to add T* auto_buffre::stack_buffer() though.
-Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk