TWeakPtr::WeakReferenceCount
#include "Templates/SharedPointer.h"
Access: private
Description
The weak reference controller shared among all TSharedPtr and TWeakPtr instances pointing to the same object. Its IsValid() method returns false once the last TSharedPtr/TSharedRef is released.
Caveats & Gotchas
- • The reference controller object itself is heap-allocated and outlives the referenced object — this is by design so that weak pointers can detect expiry. The controller is freed only when both shared and weak reference counts reach zero.
- • In ThreadSafe mode (ESPMode::ThreadSafe), the reference count operations use atomic instructions; in NotThreadSafe mode they do not, making NotThreadSafe TWeakPtr unsafe to share across threads even for read operations.
Signature
SharedPointerInternals::FWeakReferencer< Mode > WeakReferenceCount See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?