|
Boost : |
Subject: Re: [boost] request for discussion - yet another approach to automated memory management that solves the cycles problem and is very efficient
From: Larry Evans (cppljevans_at_[hidden])
Date: 2009-02-27 16:23:28
On 02/27/09 14:13, Achilleas Margaritis wrote:
>> 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.
>
> Indeed. I think the algorithm works for immutable ptrs only.
>
Aren't mutable ptrs necessary for creating cycles? Suppose
the ptr graph is B->A->B. (IOW, object B has pointer, B.ptr which points
to object A, and object A has pointer, A.ptr which points to B.)
Now, either A or B must be created first. When the first one is
created (suppose it's B) it can't be constructed already pointing to A
because A hasn't been created yet. Consequently, B.ptr must be mutable
in order to eventually point to A.
Am I missing something?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk