Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2003-01-27 22:04:09


At 05:47 PM 1/27/2003, Andrei Alexandrescu wrote:

>Q. Why doesn't shared_ptr provide (your pet feature here)?
>A. Because (your pet feature here) would mandate a reference counted
>implementation or a linked list implementation, or some other specific
>implementation. This is not the intent.
>
>This is a presupposition. Someone wants to mandate lazy
>initialization/specific dereference testing/specific initialization
>testing/tons others. Would any of these require a refcounted/reflinked
>implementation?

That particular FAQ item was written quite a while ago, before weak_ptr
support, before custom deleter support, etc. We had gotten several requests
for features that seemed to tilt the spec strongly toward one or the other
of the implementation techniques.

The question of whether "any of these require a refcounted/reflinked
implementation?" is a good one.

The question came up with use_count(), and was handled by not requiring
use_count() be constant complexity.

For a shared-ownership smart pointer with weak_ptr support, I expect some
people will say that mandates a refcounted rather than reflinked
implementation. I don't think that is true, but it may make a reflinked
implementation less attractive. What's your opinion on that?

--Beman


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