Boost logo

Boost :

Subject: Re: [boost] Interest in StaticVector - fixed capacity vector
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-10-14 06:32:02

on Thu Oct 13 2011, Nevin Liber <> wrote:

> On 13 October 2011 18:08, Andrew Hundt <athundt_at_[hidden]> wrote:
>> After comments by Nate Ridge, Dave Abrahams, and others, I have become
>> convinced that push_back should be unchecked and exceeding the bounds
>> should be undefined, with an option to turn on checking.
> While I really disagree with this (as there are both use cases for it

Use-cases, please!

Let's not overlook anything important in this discussion.

> and, more importantly, it is no longer a drop in replacement for
> vector because your push_back will now behave differently),

How could it ever be a "drop-in replacement for vector" when it comes to
exceeding a reasonably low length bound? A vector is probably going to
succeed to push_back past that bound, while this class definitely won't.
Unless you plan to intentionally leverage this exception (in which case
vector wasn't serving your needs, so your code needs more than a
"drop-in-replacement" anyway), then it's *going* to change the behavior
of your program if and when you cause it to be thrown.

Maybe I'm missing something.

Dave Abrahams
BoostPro Computing

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