From: Larry Evans (jcampbell3_at_[hidden])
Date: 2003-06-01 22:00:14
Chuck Messenger wrote:
> Schoenborn, Oliver wrote:
>> ... Strict ownership means that only one object at any
>> given time can be the owner. This is pretty straightforward and the raw
>> pointer example shows that there is no such thing as cyclic strict
>> that works, at least within the above definition of ownership,
> Which is why the strict ownership paradigm doesn't work with cyclic
> structures. Inherently, in the general case, cyclic structures
> *require* garbage collection (or to be more precise, some dynammic
> programming cycle-finding algorithm, whether or not you call it "garbage
> collection") to harvest stranded cycles of objects.
> Yes, as Peter Dimov suggested, you can sort of "game" the problem by
> dividing your structures into Vertex and Edge types, allowing for a
> classic strict ownership hierarchy. But that just leaves the garbage
> collection problem to the programmer.
seems to support Oliver's viewpoint. I remember reading another post
somewhere where someone required cycles because he was
creating a graph from reading input from a file and couldn't know who
owned who. However, if he's reading from a file, he must
have some map from vertex_name -> vertex_node, and this map
would be the sole owner. All the vertex_nodes would simply be
weak_ptr's to other vertex_nodes.
The above cited post was in a long thread discussing on this topic.
It might be worth reading.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk