Subject: Re: [boost] Looking for thoughts on a new smart pointer: shared_ptr_nonnull
From: Mostafa (mostafa_working_away_at_[hidden])
Date: 2013-10-02 18:19:38
On Wed, 02 Oct 2013 12:09:56 -0700, Matt Calabrese <rivorus_at_[hidden]>
> On Wed, Oct 2, 2013 at 4:18 AM, Luke Bradford
>> Thanks for the feedback, Matt - some quick thoughts:
>> I also think that having a conversion to bool is misleading -
>> in the use cases I've seen, it would lead to a lot of extraneous if(
>> ptr )
>> statements, then essentially if( true ), which obscure the programmer's
>> intentions and are easy to remove. I found the elimination of the
>> constructor and conversion to bool just as useful, if not more useful,
>> the runtime checks of the class, because they revealed places where we
>> default constructing or checking a shared_ptr that we expected to be
>> at all times.
> The point isn't for people to use them in new code written specifically
> the type, it's both to transition from old code and to work fine with
> generic code. You can also think of it as how boost::variant has an
> function that just always returns false.
Maybe I'm just being thick, why can't you just cast it/wrap it as a
shared_ptr obj before passing it to such generic code?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk