Boost logo

Boost :

Subject: Re: [boost] Interest in StaticVector - fixed capacity vector
From: Christian Holmquist (c.holmquist_at_[hidden])
Date: 2011-10-13 23:14:12


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.
>
> I haven't been convinced how the option should be defined, though I've
> seen several options:
> 1) locally defined option
> 2) defined generally for boost
>

2) Please no. Global policies like BOOST_NO_THREADS and, as I think this
discussion have shown, BOOST_THROW_EXCEPTION is not fine grained enough.
There seems to be some consensus on the usefulness of undefined behaviour if
exhausting the capacity of the vector, which is fine (even as default if
stated clearly in the docs), as long as user can opt for an alternative that
throws.

> 3) combination of 1 and 2, since they are not mutually exclusive
> 4) policy based.
>

4) seems like the best compromise. (how does 4 differ from 1?).

- Christian


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