Subject: Re: [boost] Looking for thoughts on a new smart pointer: shared_ptr_nonnull
From: Eric Niebler (eniebler_at_[hidden])
Date: 2013-10-04 12:45:14
On 10/4/2013 9:20 AM, Matt Calabrese wrote:
> but I definitely am against an exception for this type of
> programmer error.
This is the crux of it. If this condition really does represent a
programmer error (and IMO in this case it does), then Matt is right.
Throwing is wrong. Programmer error == bug == your program is already in
some weird state. Continuing by throwing an exception and executing an
arbitrary amount of code is not good.
Precondition violations ==> assertions. Use BOOST_ASSERT. That gives
people a way to hook the behavior while giving a sane default.
-- Eric Niebler Boost.org http://www.boost.org
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk