Boost logo

Boost :

Subject: Re: [boost] Interest in StaticVector - fixed capacity vector
From: Olaf van der Spek (ml_at_[hidden])
Date: 2011-10-12 07:39:06

On Wed, Oct 12, 2011 at 12:38 PM, Stewart, Robert
<Robert.Stewart_at_[hidden]> wrote:
>> I'd really like to see the interface be as close to C++11
>> std::vector as possible (other than vector<bool>).
> Interface is one thing.  That doesn't address the idea of throwing exceptions when exceeding capacity.  Many wanting to use static_vector in embedded environments don't want exceptions.  The rest of us find them useful.  Still, BOOST_THROW_EXCEPTION provides a means to configure that, but it affects all Boost code; localizing the effect may be desirable.  Matt called for a differently named container as a means to provide the no-exception behavior.  I think a policy class, defaulted to the throwing behavior, is the better approach, despite Jeff's thinking it an unnecessary complication.

Is it a logic error or a runtime error? IMO exceeding the capacity
here is a logic error and should be handled with an assert by default.
Isn't it comparable to doing a pop_back() on an empty vector?


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