Phil, On 04/11/2016 07:41 AM, Phil Bouchard wrote:
On 04/10/2016 04:07 PM, Artyom Beilis wrote:
3. What happens when root_ptr is deleted and node_ptr exists? Does use of node_ptr lead to undefined behavior? If so it should be marked as big warning.
You can't construct a node_ptr without a root_ptr so node_ptrs are always instantiated after a root_ptr.
To begin with, I feel that your main argument in favor of your library compared to the std::shared_ptr is that your library takes care of cycles. I am personally yet to be convinced that the cycles-related problem is actually as big as you make it. More so, std::shared_ptr does manage cycles with weak_ptr and discipline. ;-) Second, I feel that Artyom asked an excellent question which IMO highlights a fundamental flaw with your library. I feel that your library does not solve the cycles problem but rather replaces it with another problem. Namely, the problem of managing the life-cycle of the memory manager (strangely called root_ptr). And IMO that problem is quite serious given that all node_ptrs spawned from the main root_ptr are freed (regardless of the cycles or existing references) when that root_ptr is destroyed. Regards, Vladimir.