From: Carl Daniel (cpdaniel_at_[hidden])
Date: 2002-01-30 11:27:02
From: "Darin Adler" <darin_at_[hidden]>
> 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?
IMO, yes. For small, fixed-size vectors, this approach can use significantly less memory, with no dynamic allocation (I
hope, I haven't looked at the posted code yet).
> > As for the name, I simply named this class as `array2', but presumably
> > it's not a good name. 'resizable_array', `variable_array', or
> > `fixed_capacity_vector' might be better. One possibility should be to
> > combine the current boost::array class template and my new one into
> > one class template, and to specialize depending on the third template
> > parameter:
> I like the name fixed_capacity_vector. I don't think it makes sense to
> combine this with the array class template.
I wrote a similar class which I called fixed_vector to serve the same purpose. It's definitely something I'd like to
see in Boost.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk