A smart pointer to a managed CCObject-deriving class. Like Ref, except only holds a weak reference to the targeted object. When all non-weak references (Refs, manual retain() calls) to the object are dropped, so are all weak references.
In essence, WeakRef is like a raw pointer, except that you can know if the pointer is still valid or not, as WeakRef::lock() returns nullptr if the pointed-to-object has already been freed.
Note that an object pointed to by WeakRef is only released once some WeakRef pointing to it checks for it after all other references to the object have been dropped. If you store WeakRefs in a global map, you may want to periodically lock all of them to make sure any memory that should be freed is freed.