How it works...

There are some differences between weak pointers and shared pointers. Weak pointers do not have the capability to keep the object in memory when the reference count drops to 0.

The advantage of using a weak pointer (over a raw pointer) is that, when the object underneath the weak pointer is manually deleted (using ConditionalBeginDestroy()), the weak pointer's reference becomes a NULL reference. This enables you to check whether the resource underneath the pointer is still allocated properly by checking a statement of the following form:

if( ptr.IsValid() ) // Check to see if the pointer is valid 
{ 
}