Boost logo

Boost :

Subject: Re: [boost] Looking for thoughts on a new smart pointer: shared_ptr_nonnull
From: Matt Calabrese (rivorus_at_[hidden])
Date: 2013-10-03 15:55:51


On Thu, Oct 3, 2013 at 9:37 AM, Thorsten Ottosen <
thorsten.ottosen_at_[hidden]> wrote:

> shared_obj<Foo> sharedFoo = make_shared_obj( 42, "foo" );
>
> would be good names.
>

The only issue with this is your type may not be allocated with new and you
may want a custom deleter (you may also want to take control from a
separately allocated object). These are things that shared_ptr can handle,
but with a strict interface such as this, the non-null ptr cannot. That
said, I personally don't care, but if the intent is to just have a non-null
shared_ptr then we shouldn't be sacrificing existing functionality. It
should simply be a shared_ptr with a non-null invariant and that is that.

-- 
-Matt Calabrese

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk