Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-07-13 09:37:37


From: "Beman Dawes" <bdawes_at_[hidden]>
> >What are the complexity requirements of the boost::shared_ptr<> member
> >functions?
>
> They are currently unspecified. At least for now, that's probably
> best. See below.

IOW, a linked-list implementation is conforming. This is good. :-)

> >An interesting related question is "why does shared_ptr have use_count?"
>
> As an aid to writing test cases and debugging displays. One of the
> progenitors had use_count(), and it was useful in tracking down bugs in a
> complex project that turned out to have cyclic-dependencies.

This should probably be documented (along with the decision to not specify
complexity requirements.)

Why is this important? Because some nice interface additions to shared_ptr
(my shared_ptr_id proposal, for instance) would be inappropriate under a
linked-list implementation.

Perhaps this deserves a new FAQ entry:

Q: Why doesn't shared_ptr provide (your pet feature here)?
A: Because (your pet feature here) would mandate a reference counted
implementation. This is not the intent.

--
Peter Dimov
Multi Media Ltd.

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