Subject: Re: [boost] Using Boost.Atomic for shared_ptr
From: Domagoj Saric (domagoj.saric_at_[hidden])
Date: 2009-12-24 06:43:47


"Phil Endecott" <spam_from_boost_dev_at_[hidden]> wrote in message
news:1261336563627_at_dmwebmail.dmwebmail.chezphil.org...
> Dear All,
>
> I have just had a quick look at how easily shared_ptr could be adapted to use
> Helge's proposed Boost.Atomic.

Apologies for perhaps going slightly offtopic/broadening the discussion, but
wouldn't it be even better if the whole boost smart_ptr 'architecture' was
refactored to extract/separate all of the orthogonal functionality/concepts that
could then be used to build whatever specific smart pointers we like:

- reference count: none, single threaded, multi threaded, COM ...
- deleter: fixed, statically specified, dynamically specified
- copy semantics: move, deep, shallow, shared, disabled/scoped
- 'unused bits usage'/data 'compression'/injection': none, based on type
alignement, platform...
- empty/null pointer dereference handler: crash, assert, throw, return a
static/global/default value/instance...
- weak_ptr...
...

It would also make it easier to merge the knowledge and functionality currently
existing in the private shared_ptr's reference count implementation with
boost::atomic and at the same time we would get a public/'official' and reusable
boost reference count implementation...

I'd volunteer to work/help on such a change.

--
 "That men do not learn very much from the lessons of history is the most
important of all the lessons of history."
 Aldous Huxley