|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-07-14 17:25:33
Jaap Suter wrote:
> Are there compelling reasons not to add such a member function, i.e. a
> different shared_ptr implementation wouldn't be able to provide such a
> function?
Possibly. I think that an implementation that uses statically allocated
control blocks for empty pointers to avoid the NULL check can't tell the
difference between empty and expired weak pointers. But I'm not sure.
We need to specify how an arbitrary weak_ptr responds to this member
function (it can be constructed in a variety of ways) first, of course. I'd
just go with the boolean. :-) (Arguably a good idea even if weak_ptr has a
query.)
That said, can you describe how guarded_memory is supposed to be used in
more detail? Locking a weak_ptr and then not using the result is somewhat
unusual. Why doesn't it just store a weak_ptr<void> that points to the
memory block?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk