From: Dan Nuffer (dnuffer_at_[hidden])
Date: 2002-01-30 11:24:56
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.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk