Boost logo

Boost :

Subject: Re: [boost] Looking for thoughts on a new smart pointer: shared_ptr_nonnull
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2013-10-11 04:47:58


On 10-10-2013 20:56, Nevin Liber wrote:
> 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()."

Right. Different words. Same meaning. You cut out the quote from the
standard that said:

""17.6.4.11 Requires paragraph [res.on.required]

Violation of the preconditions specified in a function’s
Requires:
paragraph results in undefined behavior
unless the function’s
Throws:
paragraph specifies throwing an exception when the precondition is
violated."

> Not fitting your mental model is not a bug in the standard...

Nevin,

I think it's pointless to continue this discussion. I know your view,
you know mine.

kind regards

-Thorsten


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