|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-05-01 05:14:16
From: "Greg Colvin" <greg_at_[hidden]>
> So the question is, what is the distribution of the numbers of
> shared_ptr per object? And what is the distribution of the size of
> objects? And how much overhead is too much? My take is that the
> question of whether to support weak_ptr by default in the standard
> library comes down to how useful the feature is more than to how
> much overhead is creates.
>
> For boost, we have already made that choice, but recently enough
> that we haven't gotten much feedback on whether the cost is OK.
Yep. For boost, there are some additional reasons for weak_ptr's existence.
(1) proof of concept; (2) very subtle and non-trivial interface for safety
reasons; (3) having boost::weak_ptr allows us to gather - at least some -
field experience as to the cost/usefulness tradeoff. (My personal opinion is
that it's worth it; to break cycles, one has to use either a weak or a raw
pointer.)
It should be clear that boost::weak_ptr is an optional part of the proposal.
It can be rejected by the LWG, and this will not impact shared_ptr in any
significant ways.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk