|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-01-07 17:33:56
From: "David Abrahams" <dave_at_[hidden]>
>
> Yes, but IIUC the reason the library's not doing it is because you
> might get the order wrong, which could cause a problem like a dangling
> pointer needed for some destructor.
Not really... The library's not currently doing it because it hasn't been my
goal to provide a "real" garbage collected pointer. sp_debug_hooks.cpp is an
example that demonstrates what can be done with the debug hooks called by
shared_ptr; code using it operates in "safe mode" (or slightly safer mode.)
IOW a shared_ptr cycle is still not supposed to happen in bug free programs.
That aside, can you think of a reasonable design that does not depend on
intentionally created shared_ptr cycles, but still needs a correct
destruction order when a cycle is broken?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk