Boost logo

Boost :

Subject: Re: [boost] Interest in StaticVector - fixed capacity vector
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-10-15 20:46:37


on Sat Oct 15 2011, "Peter Dimov" <pdimov-AT-pdimov.com> wrote:

> Nathan Ridge wrote:
>
>> My problem required storing a variable but compile-time-bounded
>> number of not-necessarily-default-constructible-objects in an array.
>> Specifically, I was storing some representation of the sub-simplex
>> intersections between two d-dimensional simplices, where d was a
>> compile-time constant (typically 2 or 3). The number of such
>> intersections
>> is bounded in terms of the dimension d, and this was a computational
>> intensive part of the application, so avoiding heap access was desirable.
>
> This is a good example. If the intended use case of this class is only
> when the size is compile time bounded, I agree that
> push_back/insert/resize should assert. If it's intended to have a
> wider use, though...

In the wider use-cases why isn't "fall back to the heap" the right thing
to do?

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk