$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] Looking for thoughts on a new smart pointer: shared_ptr_nonnull
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2013-10-02 09:07:40
On 02-10-2013 14:52, Jeff Flinn wrote:
> As Matt said this would be a precondition violation so an assert would
> be better than a runtime exception.
I'd rather see we do as in Boost.PtrContainer: use BOOST_THROW_EXCEPTION
such that if BOOST_NO_EXCEPTION is defined
(or BOOST_SMART_PTR_NO_EXCEPTION), this becomes an assert. The run-time
check during construction is not going to be noticed.
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.
-Thorsten