Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-10-30 09:58:13


Gennaro Prota <gennaro_prota_at_[hidden]> writes:

> On Wed, 30 Oct 2002 14:25:38 +0100, Joaquín Mª López Muñoz
> <joaquin_at_[hidden]> wrote:
>
> >I think an interesting thing to have is a resizable array template whose
> >initial footprint is statically assigned. So, the programmer can first dimension
> >it with a reasonable size allocated on the stack without heap overhead and
> >only on rare occasions would the array go for the heap when this size
> >is exceeded. Sort of like the best of both worlds, if you know what I mean.
>
> Yes, you mean a "small array optimization". The classical union
> array/pointer. I don't know whether that's a good idea or not, for
> various reasons. It depends a lot on what operations you want to allow
> on the array.

Right. For example, providing a nothrow swap will be difficult or
impossible ;-). That's not a showstopper, IMO, though.

-- 
                    David Abrahams
dave_at_[hidden] * http://www.boost-consulting.com

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