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 12:37:45

On 02-10-2013 13:40, Andrey Semashev wrote:
> On Wed, Oct 2, 2013 at 2:54 AM, Luke Bradford <lukebradford01_at_[hidden]> wrote:
>> Hi,
>> I'm new to this list, so apologies for any oversights or faux pas.
>> I've been finding a lot of use for a type of smart pointer I call
>> shared_ptr_nonnull, which is a variation on shared_ptr which is never
>> allowed to be empty. Specifically:

> Anyway, I think, such a pointer does not behave like a real pointer,
> so it shouldn't be called as such. It looks more like a reference,
> except that the referred object is accessed through operator->. Maybe
> it should be called shared_ref because of it.

I'm inclined to think that

   template< class T >
   class shared_obj;

with use like

   shared_obj<Foo> sharedFoo = make_shared_obj( 42, "foo" );

would be good names.


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