Boost logo

Boost :

From: Fernando Cacciola (fernando_cacciola_at_[hidden])
Date: 2002-10-30 10:47:58

----- Original Message -----
From: "David Abrahams" <dave_at_[hidden]>
To: "Boost mailing list" <boost_at_[hidden]>
Sent: Wednesday, October 30, 2002 11:58 AM
Subject: Re: [boost] Re: Boost Array: read/write access to entire data

> 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
> > >initial footprint is statically assigned. So, the programmer can first
> > >it with a reasonable size allocated on the stack without heap overhead
> > >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
> >
> > 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.
Good point.
Anyway, the double-buffer technique for nothrow swap of aligned storages
discussed some time ago *might* apply even here, at least if the user is
willing to allow twice the static-size being actually stack allocated.
(and IMO, I wouldn't mind to stack-allocate twice the size if the
performance gain is significant)

Fernando Cacciola

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