|
ubit
|
Smart Pointer for UObject instances. More...
#include <uobject.hpp>
Protected Member Functions | |
| void | deferenceError () const |
Smart Pointer for UObject instances.
All classes that derive from UObject support UPtr SMART POINTERS (SP), which provide automatic memory management (based on reference counting). UObject(s) are automatically deleted when nothing reference them, i.e. when the last reference from a UPtr or from anoher UObject is removed.
UPtr is the base class for upr<> templates as shown in the examples below:
uptr<UBox> box = new UBox(); // 'box' is a Ubit Smart Pointer uptr<UButton> btn = ubutton("Do It!"); // ubutton() == *new UButton() box->add(*btn); // the UButton is a child of the UBox
box = null; // destroys this UBox because it has no parent and no other // uptr<> pointing to it (its UButton child is not destroyed // because 'btn' points to it)
btn = null; // destroys this UBox because it has no parent and no other // uptr<> pointing to it.
NOTES:
1.8.12