Navigation
API > API/Runtime > API/Runtime/AutoRTFM
An object wrapper that will ensure the copy constructor, move constructor, copy assignment, move assignment and destructor are all called in the open. This can be used to wrap a lambda capture if it is known that it safe and more optimal to copy, move & destruct the object in the open.
For example - it may be safe to wrap a shared pointer with a TOpenWrapper when capturing for use by AutoRTFM::OnCommit() or AutoRTFM::OnAbort(), as the AutoRTFM::TTask destructor will be called regardless of a transactional failure or commit. This may be preferable to capturing the unwrapped shared pointer as we can avoid costly closed transactional logic to ensure the count is restored on failure: AutoRTFM::OnCommit([WrappedSharedPtr = AutoRTFM::TOpenWrapper{MySharedPtr}] { WrappedSharedPtr.Object->DoSomething(); });
| Name | TOpenWrapper |
| Type | class |
| Header File | /Engine/Source/Runtime/AutoRTFM/Public/AutoRTFM/OpenWrapper.h |
| Include Path | #include "AutoRTFM/OpenWrapper.h" |
Syntax
template<typename ObjectType>
class TOpenWrapper
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TOpenWrapper
(
const TOpenWrapper& |
AutoRTFM/OpenWrapper.h | ||
TOpenWrapper
(
TOpenWrapper&& |
AutoRTFM/OpenWrapper.h | ||
TOpenWrapper
(
const ObjectType& Value |
AutoRTFM/OpenWrapper.h | ||
TOpenWrapper
(
ObjectType&& Value |
AutoRTFM/OpenWrapper.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~TOpenWrapper() |
AutoRTFM/OpenWrapper.h |
Variables
Public
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| Object | ObjectType | AutoRTFM/OpenWrapper.h |
Functions
Public
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TOpenWrapper & operator=
(
const TOpenWrapper& |
AutoRTFM/OpenWrapper.h | ||
TOpenWrapper & operator=
(
TOpenWrapper&& |
AutoRTFM/OpenWrapper.h |