Navigation
API > API/Runtime > API/Runtime/Core
TPromise Template for promises.
| Name | TPromise |
| Type | class |
| Header File | /Engine/Source/Runtime/Core/Public/Async/Future.h |
| Include Path | #include "Async/Future.h" |
Syntax
template<typename ResultType>
class TPromise
Inheritance Hierarchy
- FPromiseBase → TPromise
- TPromise
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
TPromise () |
Default constructor (creates a new shared state). | Async/Future.h | |
TPromise
(
TUniqueFunction< void()>&& CompletionCallback |
Create and initialize a new instance with a callback. | Async/Future.h | |
| Movable-only. | Async/Future.h | ||
| Async/Future.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~TPromise() |
Destructor. | Async/Future.h |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| SetType | std::conditional_t< std::is_void_v< ResultType >, int, ResultType > | This is necessary because we can't form references to void for the parameter of Set(). | Async/Future.h |
| StateType | TFutureState< ResultType > | Async/Future.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| bFutureRetrieved | bool | Whether a future has already been retrieved from this promise. | Async/Future.h | |
| State | TSharedPtr< StateType > | Holds the shared state object. | Async/Future.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void EmplaceValue
(
ArgTypes&&... Args |
Sets the promised result. | Async/Future.h | |
TFuture< ResultType > GetFuture() |
Gets a TFuture object associated with the shared state of this promise. | Async/Future.h | |
void SetValue () |
Async/Future.h | ||
void SetValue
(
const SetType& Result |
Sets the promised result. | Async/Future.h | |
void SetValue
(
SetType&& Result |
Async/Future.h |
Protected
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
const TSharedPtr< StateType > & GetState() |
Gets the shared state object. | Async/Future.h |