Boost logo

Boost :

From: Matthias Troyer (troyer_at_[hidden])
Date: 2002-01-30 13:18:30

On Wednesday, January 30, 2002, at 05:05 PM, 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?

Yes, definitively for our example. We might need to allocate of the
order of
10 million such arrays for a graph. The overhead of 1e7 vectors would
be too much.
>> 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.

Sounds good to me


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