Subject: [boost] [utility] new auto_buffer class --- RFC
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2009-03-01 16:04:56
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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk