
On 04/04/2016 01:48 PM, Larry Evans wrote:
Could you please explain how an intrusive list prevents cycles.
Wherever you want to insert an element inside an intrusive_list, it will automatically reorganize the pointers to the previous node and to the next node so that the former references are lost and the new ones are created. You can have a cycle if former references are destroyed first. But I might confuse you even more by trying to explain this extra-curriculum subject.
I'm probably misinterpreting what the arrow means from the lower node_proxy to the upper node_proxy. I was interpreting that to mean that node_proxy contained some node_proxy* member variable. However, looking at the code here:
https://github.com/philippeb8/root_ptr/blob/master/include/boost/smart_ptr/r...
and searching for node_proxy, I see no such member variable pointer.
So when a node_proxy is unified with another one it enlists the new node_proxy with the following tag: mutable smart_ptr::detail::intrusive_list::node proxy_tag_; You can see here that the way to iterate through all node_proxies unified together is done the following way: using namespace smart_ptr::detail; for (intrusive_list::iterator<node_proxy, &node_proxy::proxy_tag_> i(&proxy_tag_);;) { ... if (++ i == intrusive_list::iterator<node_proxy, &node_proxy::proxy_tag_>(&proxy_tag_)) break; } For the record, the list of allocated nodes associated to a specific node_proxy is stored in the following intrusive list: mutable smart_ptr::detail::intrusive_list node_list_;
Could you further explain the meaning of the arrow in that #root_ptr.rationale.union diagram?
Once again, when node_proxies are unified then it will use node_proxy::proxy_tag_ to link the node_proxies altogether.