FastLED 3.9.15
Loading...
Searching...
No Matches

◆ lock()

template<typename T>
Ptr< T > fl::WeakPtr< T >::lock ( ) const
inline

Definition at line 354 of file ptr.h.

354 {
355 if (!mWeakPtr) {
356 return Ptr<T>();
357 }
358 T* out = static_cast<T*>(mWeakPtr->getReferent());
359 if (out->ref_count() == 0) {
360 // This is a static object, so the refcount is 0.
361 return Ptr<T>::NoTracking(*out);
362 }
363 // This is a heap object, so we need to ref it.
364 return Ptr<T>::TakeOwnership(static_cast<T *>(out));
365 }
static Ptr TakeOwnership(T *ptr)
Definition ptr.h:111
static Ptr NoTracking(T &referent)
Definition ptr.h:116
Ptr< WeakReferent > mWeakPtr
Definition ptr.h:382

References mWeakPtr, fl::Ptr< T >::NoTracking(), and fl::Ptr< T >::TakeOwnership().

Referenced by operator==().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: