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-08 10:26:54


On 08-10-2013 14:00, Thorsten Ottosen wrote:

> The shared_ptr implementation would have to check its template argument
> and emit special code in a few places. This is very easy to do, and far
> easier than specializing/wrapping the class.

Another benefit of this approach is that we can create different
behaviors without relying on the absurd subtleties of the preprocessor:

   typedef boost::shared_ptr<T> SharedT; // normal shared_ptr
   typedef boost::shared_ptr<assert_non_null<T>>
        NonNullSharedT; // no null enforced by assertions
   typedef boost::shared_ptr<enforce_non_null<T>>
         NeverNullSharedT; // no null enfoced by exceptions

regards

-Thorsten


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