|
Boost : |
Subject: Re: [boost] Looking for thoughts on a new smart pointer: shared_ptr_nonnull
From: Nevin Liber (nevin_at_[hidden])
Date: 2013-10-10 14:56:41
On 10 October 2013 12:09, Thorsten Ottosen <thorsten.ottosen_at_[hidden]>wrote:
>
> I guess it's because I view the precondition as the requirement for
> correct execution. It's the same for both functions. They differ in how
> they respond to an incorrect argument. UB vs. an exception.
>
That's you.
The standard is quite clear on this: n3690 23.2.4p17: "The member function
at() provides bounds-checked access to container elements. at() throws
out_of_-range if n >= a.size()."
Not fitting your mental model is not a bug in the standard...
-- Nevin ":-)" Liber <mailto:nevin_at_[hidden]> (847) 691-1404
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk