Subject: Re: [boost] Interest in StaticVector - fixed capacity vector
From: Marshall Clow (mclow.lists_at_[hidden])
Date: 2011-10-11 20:19:05
On Oct 11, 2011, at 5:11 PM, Jeffrey Lee Hellrung, Jr. wrote:
> On Tue, Oct 11, 2011 at 4:55 PM, Christian Holmquist <c.holmquist_at_[hidden]>wrote:
>> FWIW, I think that static_vector should throw std::bad_alloc if it runs out
>> of space, to mimic an out of memory situation for ordinary containers.
>> (Consider an algorithm that needs temporary storage, and user passes a
>> static_vector as tmp storage policy. The algorithm might be designed to
>> handle std::bad_alloc in some way).
> I'm presently against any throwing behavior related to resizing of a
> StaticVector/static_vector, since one can usually easily check the relevant
> preconditions themselves. Just assert. For those who want defined behavior
> in resize overflow (or underflow) situations, I'd say derive or wrap. Some
> kind of policy template parameter could be possible, but right now it feels
> like that's an unnecessary complication on an otherwise relatively simple
> data structure.
> That's not to say I can't be dissuaded from this opinion.
If you are checking all the preconditions yourself, why do you care if it throws or not?
[ That sounds glib - but it's a serious question. ]
Why do you care if it ASSERTs, calls abort (), throws, or gets your cat pregnant?
Marshall Clow Idio Software <mailto:mclow.lists_at_[hidden]>
A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
-- Yu Suzuki
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk