On Wednesday, 5 February 2014 at 19:13:01 UTC, Adam D. Ruppe
wrote:
It sounds to me like... a separate type. The deallocator is the
destructor!
Yes, but "destructor" of the reference counter object is
"decrease count by one", when it goes to zero. Not when it is
destroyed.
Sure, you can use classes for it, but I don't think you want to.
It is better to have a uniform reference counter object that can
be fully inlined with no function calls as the general case and
then only call the external "deallocator" with itself as
parameter when it is present.