Boost logo

Boost :

Subject: Re: [boost] Interest check: container with preallocated buffer
From: Ross Levine (ross.levine_at_[hidden])
Date: 2009-05-27 11:01:42


I would encourage you to read Effective STL, Chapter 10. There's definitely
no easy way to do this since allocators are typically used through rebind,
and allocators may not have (non-static) state.

On Mon, May 25, 2009 at 8:26 PM, OvermindDL1 <overminddl1_at_[hidden]> wrote:

> > Thorsten Ottosen wrote:
> >>
> >> Dmitry Vinogradov skrev:
> >>>
> >>> Boost.Array offers constant size container with preallocated buffer,
> >>> Boost.Optional provides from zero to one element. There are no STL
> container
> >>> with preallocated buffer and it seems custom allocator does not help to
> do
> >>> this with existing containers.
> >>>
> >>> Does any container exist to offer functionality like Boost.Array but
> >>> allowing to store from 0 to N elements? Is there any interest in such
> >>> container?
> >>>
> >>> PS. It's similar to fixed_string but as a generic container.
> >>
> >> Please see
> >>
> >> http://www.cs.aau.dk/~nesotto/boost/auto_buffer.zip>
> >>
> >>
http://www.cs.aau.dk/~nesotto/boost/trunk/libs/auto_buffer/doc/html/>
>
> I am curious. Would it not be possible to implement a class that
> handles memory allocations of the standard STL style and just pass an
> instance of that allocator (after allocated on the stack of course) to
> the stl::vector template parameter, or does std::vector require a
> class type? I have not read the standard in this area, and from above
> I guess the C++0x is more clear on this?
> _______________________________________________
> Unsubscribe & other changes:
>
http://lists.boost.org/mailman/listinfo.cgi/boost
>


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