I’ve taken a liking to smart pointers lately. The overhead is negligible and it’s vastly easier than having to keep track of pointers all over the place.
I read a bit about the std smart pointer. I don’t understand why the articles on smart pointers are so long or complicated, or why the boost library made a smart pointer. To me this seems the easiest thing in the world. Perhaps I don’t understand all the issues involved?
To use it, just derive your class from RakSmartObj. When instantiating your class, assign the pointer to an instance of RakSmartPtr. When all instances of RakSmartPtr are deleted or assigned to 0, then the class instance is automatically deleted.