@nprofile1q... sounds much like you really ought to instead have a factory that spits out these objects:
I'd frankly have smth like the "actual type" you want to work with, and a wrapper class. Hint: you can use `std::unique_ptr<class object_t, class Deleter>`'s `Deleter` to implement the "remove pointer from registry, then actually call `delete` on the stored pointer" functionality. The registry could be `std::unordered_set<object_t*>`.
Factory is function returning these `unique_ptr`s.