27-Sep-2014 23:15, Andrei Alexandrescu пишет:
On 9/27/14, 2:43 AM, Dmitry Olshansky wrote:
Refcounting is process of add(x), and sub(x), and calling destructor
should the subtract call report zero. Everything else is in the hands of
the creator.
I literally have no idea what you are discussing here. -- Andrei
That proposed scheme is completely abstract as to what exactly adding X
to a ref-count does. Or what exactly subtracting X from ref-count does.
The only invariant is that there is something that will tell us after
yet another decrement that ref-count is zero and we should free resources.
As I said elsewhere - automagically embedding ref-count is too limiting,
there is whole lot of ways to implement count including intrusive and
non-intrusive.
--
Dmitry Olshansky