From: Peter Dimov (pdimov_at_[hidden])
Date: 2008-04-26 12:10:28
> My new version even allows one more use case:
> When the refactored implementation reaches line 130, the
> weak_count.use_count() == 0 is true, thus init_weak_once() initializes a
> fresh _shared_count/_weak_count pair and expects someone else to take
> over ownership later as if the object was just created.
Yes. What is the motivation for this use case?
Given the sequence:
1. Object is created
2. A shared_ptr takes ownership
3. Owner dies
4. Another shared_ptr takes ownership
the original esft allowed shared_from_this calls after 2 and 4, but not
after 1 or 3. The new esft allows shared_from_this after 1 as well with the
motivation to support calls from within the object constructor. But the
constructor only runs once, so this motivation doesn't extend to 3.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk