News for hackers. Stuff that matters.
Re:Garbage Collection is Wrong by mikeash on Thursday February 27, 2014 @04:49PM (#7315381)
Isn't that equivalent to using a shared_ptr directly, just unnecessarily complicated?

Reference counting works fine as long as you don't have cycles, of course.

Re:Garbage Collection is Wrong by letzjuc on Thursday February 27, 2014 @05:06PM (#7315513)
The solution above works even if your graph has cycles. Of course if you know that it doesn't you can just build the graph with unique_ptrs.
Re:Garbage Collection is Wrong by mikeash on Thursday February 27, 2014 @09:11PM (#7316830)
It works with cycles, as long as you can know exactly when you want to remove something from the graph (as opposed to having it be removed when no longer referenced). Reference counting works fine that way too, though. It's a bit more work, but you just dive into the structure and manually remove references which breaks any cycles it may be involved in.