27 Nov
2019
27 Nov
'19
5:09 p.m.
On Wed, Nov 27, 2019 at 11:01 AM Peter Dimov via Boost < boost@lists.boost.org> 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