
On 02/27/09 07:21, Achilleas Margaritis wrote:\ [snip]
The idea is this the following:
An object is deleted if all the ptrs that point to it expired.
Each ptr has an age.
When a ptr releases an object, it checks if the object has any other ptrs with age older than the ptr. If not so, then it means the released ptr is the oldest one, and therefore the object should be deleted.
I unsure about that last sentence. Why does release of oldest ptr imply there are no other live ptr's pointing to the object? [snip]
It works, except when ownership of an object with cycles is transferred to a newer ptr.
This seems a serious shortcoming. To justify this, I guess you'd have to somehow argue that this use-case doesn't happen very often or that if it does, the user can easily detect that it happens and take corrective active. Then, to justify this method vs. the use of weak-ptrs, you'd have to argue why it's easier for the user to detect "transferred to a newer ptr" than it is to detect where a cycle is created.