Navigation
API > API/Runtime > API/Runtime/Core
Ref-counting mixin, designed to add ref-counting to an object without requiring a virtual destructor. Implements support for AutoRTFM, is thread-safe by default, and can support custom deleters via T::StaticDestroyObject.
AutoRTFM means that the return value of AddRef/Release can't be trusted (as the ref-count doesn't decrement until the transaction is committed), but this is fine for use with TRefCountPtr, as it doesn't use those return values.
Basic Example: struct FMyRefCountedObject : public TRefCountingMixin
Deleter Example: struct FMyRefCountedPooledObject : public TRefCountingMixin
| Name | TRefCountingMixin |
| Type | class |
| Header File | /Engine/Source/Runtime/Core/Public/Templates/RefCounting.h |
| Include Path | #include "Templates/RefCounting.h" |
Syntax
template<typename T, ERefCountingMode Mode>
class TRefCountingMixin
Derived Classes
Class Specializations
| Name | Remarks |
|---|---|
| TRefCountingMixin< T, ERefCountingMode::NotThreadSafe > | Not-thread-safe specialization |
| TRefCountingMixin< T, ERefCountingMode::ThreadSafe > | Thread-safe specialization |