From: Gennaro Prota (gennaro_prota_at_[hidden])
Date: 2002-10-30 10:01:23


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. Do you already use such a solution in one of your
applications? If so your experience could be very useful, expecially
if you have verified the difference with the dynamic-only case. I'm
trying to collect "real world tales", rather than go implementing
something that can be useful just in theory.

Genny.