News for hackers. Stuff that matters.
Re:Mistakes to avoid with C++ 11 smart pointers by userbinator on Sunday May 15, 2016 @01:47AM (#11699636)
A rule of thumb that I use is, if you cannot see the owner, then you're probably focusing too narrowly. For a directed graph, which is a "sea of nodes" with no real ordering, I would have the "graph" object own all its nodes; for an AST, if it is truly a tree, then the parent owns its children, or otherwise see the directed graph case.
Re:Mistakes to avoid with C++ 11 smart pointers by wmu on Sunday May 15, 2016 @02:01AM (#11699693)
The solution with a graph object looks nice, but when you allow some graph operations, than subgraphs could be shared among many (new) graphs. So, another level of sharing. I can't find any better solution for this problem.