Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2002-01-30 11:30:56

Dan Nuffer wrote:
> Darin Adler wrote:
> > On 1/30/02 7:45 AM, "Synge Todo" <wistaria_at_[hidden]> wrote:
> >>This class might be used almost everywhere instead of std::vector,
> >>except that its capacity is fixed to a (small) integer specified by
> >>the second template parameter, and it throws an exception when its
> >>size exceeds its capacity.
> >
> > The main question I'd ask is: Is this enough better than creating a
> > vector and reserving the desired capacity to justify creating an entire
> > separate class template?
> The fact that it doesn't do dynamic allocation can be a big performance
> advantage of fixing the capacity, depending on the application of course.
> A similar class that would be of use to me is a fixed capacity deque
> that did no allocation, but just used an array as a circular queue.
> I've actually written a class that did this, but I only wrote enough to
> satisfy my needs, it's far from being a complete container.

And there's another possible variation -- container which has fixed-size
buffer, and resorts to dynamic allocation when buffer capacity is exceeded.

- Volodya

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