ReferenceCountedObject showing signs of age


#1

What happens when the derived class overrides operator delete? It needs a ContainerDeletePolicy. But that’s very convenient, what if I forget?

It seems like the only sensible answer is to make ReferenceCountedObject a template that uses CRTP so that there is no type erasure. Then the call to delete can use

delete (static_cast<Derived*>(this));