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-03 07:26:23

On 02-10-2013 21:14, Matt Calabrese wrote:
> On Wed, Oct 2, 2013 at 6:07 AM, Thorsten Ottosen <
> thorsten.ottosen_at_[hidden]> wrote:
>> It's not only a precondition we are dealing with. It's the postcondition
>> of the constructor, that is, the invariant of the class. The normal
>> response to failing to satisfy the postcondition is to throw.
> This is very often the case when violating any precondition. The answer is
> that if you don't violate the precondition, then your variants are not
> violated. What you describe regarding exceptions actually changes your
> function's preconditions. In other words, the assert version's precondition
> is that you do not pass a null pointer. The throw version's precondition
> does not include that constraint at all -- instead, you've made passing a
> null pointer acceptable, with the behavior being that an exception is
> thrown in the case that such a pointer is passed.



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