Boost logo

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 11:19:12

On 10 October 2013 03:54, Thorsten Ottosen <thorsten.ottosen_at_[hidden]>wrote:

> I'm ok with that, although I think it's possible to have the concept of
> broken contracts separate from the concept of how to deal with broken
> contracts. Is that an unreasonable oppinion?

If you are defining the behavior, I don't see how it isn't part of the
contract. A contract is pretty much "if you pass in X, I'll do Y".

Look at the difference between vector::at() (wide contract with no
preconditions) vs. vector::operator[] (narrow contract with the
precondition that n < size()). It is impossible to violate the contract
when calling at().

 Nevin ":-)" Liber  <mailto:nevin_at_[hidden]>  (847) 691-1404

Boost list run by bdawes at, gregod at, cpdaniel at, john at