Subject: Re: [boost] Interest in StaticVector - fixed capacity vector
From: Marshall Clow (mclow.lists_at_[hidden])
Date: 2011-10-10 18:36:19
On Oct 10, 2011, at 3:47 AM, Peter Myerscough-Jackopson wrote:
> Andrew Hundt <athundt <at> gmail.com> writes:
>> On Sun, Aug 14, 2011 at 5:55 AM, Andrew Hundt <athundt <at> gmail.com> wrote:
>>> three.push_back(2); // size: 2 capacity: 3
>>> three.push_back(1); // throws std::out_of_range exception indicating the
>>> capacity has been exceeded
> Is there any chance that the error behaviour code be configurable. StaticVector
> looks ideal for embedded environments, BUT commonly exceptions are disabled in
> such an environment. It would be nice to have asserts instead of exceptions
> available in all cases, so that a programmer can check for room on a push_back
> prior to calling it. A specific StaticVector macro would suffice for those that
> need it.
IMHO, That's the whole point of using BOOST_THROW_EXCEPTION(x) instead of a naked "throw x"
If exceptions are disabled, then BOOST_THROW_EXCEPTION just calls exit().
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