A weak reference lets you hold onto a pointer to an object without
preventing the garbage collector from collecting it.
If the garbage collector collects the object then the weak pointer will
become 'null'. Thus one should always check a weak pointer for null
before doing anything that depends upon it having a value.
Creates a weak reference to a class instance.
A weak reference lets you hold onto a pointer to an object without preventing the garbage collector from collecting it. If the garbage collector collects the object then the weak pointer will become 'null'. Thus one should always check a weak pointer for null before doing anything that depends upon it having a value.
Tested with: DMD 1.025 / Phobos 1.025 DMD 1.025 / Tango 0.99.4
Usage example: