Boost logo

Boost :

From: Greg Colvin (gcolvin_at_[hidden])
Date: 2001-07-16 13:57:53


From: Beman Dawes <bdawes_at_[hidden]>
> At 06:35 AM 7/13/2001, Peter Dimov wrote:
>
> >I think that Christian has a valid question that is not addressed by
> Modern
> >C++ Design:
> >
> >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.
>
> >He asks, if I understand correctly, not how boost::shared_ptr is
> currently
> >_implemented_, but how it's _defined_.
> >
> >A question that will become more important if/when shared_ptr moves into
> >std.
>
> My guess is the committee won't want to specify complexity requirements,
> because they limit implementors and complicate the specification without
> apparent benefit to users. Almost certainly, someone will point out that
> some error-checking implementations might become non-conforming if they
> have to meet a stringent complexity requirement.

Ditto.

> In other words, it will be seen as a quality of implementation issue, not a
> specification issue.
>
> But remember that anticipating how the LWG will look at a proposal isn't a
> always possible. There is a very wide range of viewpoints present,
> including vendors, implementors, teachers, presenters, authors. Some view
> a library through the lens of user problem reports, for example, and so see
> many issue very differently from typical Boost members.
>
> >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.

Right. I would prefer to make use_count an optional feature, since
it constrains implementations unnecessarily, and I haven't seen any
use for it other than testing and debugging.

I used to maintain STL-style requirements tables for my auto_ptr and
counted_ptr proposals, an idea which might be worth resurrecting for
shared_ptr. I forget the details, but the counted_ptr requirements
were stated so as to be implementable without actually counting.


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