Boost logo

Boost :

From: Zach Laine (whatwasthataddress_at_[hidden])
Date: 2019-11-27 17:09:14


On Wed, Nov 27, 2019 at 11:01 AM Peter Dimov via Boost <
boost_at_[hidden]> wrote:

> Zach Laine wrote:
>
> > Throwing when the capacity would be exceeded is wrong.
>
> No, it's not. It's correct. It's a runtime error, not a programming time
> error.
>

Then why doesn't vector::operator[] throw? In either case, you know what
the precondition is, and how to check it. That's what makes this a user
error. With out-of-memory, I have no way to programmatically check that
(within the standard).

Zach


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