Trespasser has the smart pointer rptr which does reference counting and deletes the object if no references are left. The idea is comparable to std::shared_ptr from C++11.
Objects for rptr need to be instances of the CRefObj interface, which stores the reference count. The delete operator for CRefObj has protected visibility so that they are only deleted when the reference count reaches zero.
Unfortunately we are drowning in compiler errors because of this. Sometimes CRefObj objects are used and deleted outside of an rptr. But most errors come from places where rptr objects are created from the rptr_new and rptr_cast macros.
Besides from a complete overhaul of the rptr mechanism, I can offer no better workaround than reenabling the delete operator for the public.
Trespasser has the smart pointer
rptr
which does reference counting and deletes the object if no references are left. The idea is comparable tostd::shared_ptr
from C++11. Objects forrptr
need to be instances of theCRefObj
interface, which stores the reference count. Thedelete
operator forCRefObj
hasprotected
visibility so that they are only deleted when the reference count reaches zero.Unfortunately we are drowning in compiler errors because of this. Sometimes
CRefObj
objects are used and deleted outside of anrptr
. But most errors come from places where rptr objects are created from therptr_new
andrptr_cast
macros.Besides from a complete overhaul of the
rptr
mechanism, I can offer no better workaround than reenabling thedelete
operator for the public.