Boost logo

Boost :

Subject: Re: [boost] [utility] new auto_buffer class --- RFC
From: Edward Diener (eldiener_at_[hidden])
Date: 2009-03-06 16:47:34

Thorsten Ottosen wrote:
> Dear all,
> For a long time I have been missing this utility in my own work, and in
> boost related stuff too. I think there are a number of libraries in
> boost that can benefit from this utility. Libs like boost.format can be
> quite a bit more effective. So can logging libraries. etc.
> Basically boost::auto_buffer<T,N> is a C++ version of variable lenght
> array (from C99). It's based on Matthew Wilson's stlsoft::auto_buffer,
> which can be found described in his book "Imperfect C++".
> I have changed a few things though:
> // - no swap() and resize() provided
> // - works with allocators from Boost.Interprocess
> // - do not store T[N] on the stack, as this is bad when the
> // type has a non-trivial default constructor.
> // - handless non-pod types in an exception-safe manner
> // - has a fixed capacity, but a non-fixed size
> // - provides a non-growing (thus inlineable) push_back()
> Comments are most welcome.

What does a C VLA, or your auto_buffer class, offer that a
std::vector<T> does not have ?

Boost list run by bdawes at, gregod at, cpdaniel at, john at