Boost logo

Boost :

From: Frank Mori Hess (frank.hess_at_[hidden])
Date: 2008-04-03 09:20:09

Hash: SHA1

On Wednesday 02 April 2008 12:58 pm, Ross MacGregor wrote:
> I just created a very small smart pointer libary for our project. It will
> contain two types of shared pointers: SharedHandle and
> NullableSharedHandle. SharedHandle will be a shared pointer that cannot be
> null by ensuring a non-null construction while NullableSharedHandle will
> basically be a typedef for boost::shared_ptr.

If you're going to make a shared_ptr wrapper that acts like a reference (no
null, no reset, I assume no assignment) then why not complete the set and add
another that acts like a value? That is, one that does deep copies of the
template type on assignment, and it could also have the non-null requirement.
It would differ from an ordinary value in that you could obtain shared_ptr
(or your other wrapper types) from it which share ownership. It would be
useful for cases where you currently have a class with a shared_ptr member
but need to do deep copies of the object owned by the shared_ptr in the
containing class' assignment/copy constructor.

- --
Version: GnuPG v1.4.6 (GNU/Linux)


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