Navigation
API > API/Runtime > API/Runtime/Core
When we have an optional value IsSet() returns true, and GetValue() is meaningful. Otherwise GetValue() is not meaningful.
| Name | TOptional |
| Type | struct |
| Header File | /Engine/Source/Runtime/Core/Public/Misc/Optional.h |
| Include Path | #include "Misc/Optional.h" |
Syntax
template<typename OptionalType>
struct TOptional : private UE::Core::Private::TOptionalBase< OptionalType >
Inheritance Hierarchy
- TOptionalBase → TOptional
- TOptional
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
| Misc/Optional.h | |||
constexpr TOptional () |
Construct an OptionalType intrusively with no value; i.e. unset | Misc/Optional.h | |
constexpr TOptional () |
Construct an OptionalType with no value; i.e. unset | Misc/Optional.h | |
constexpr TOptional
(
const OptionalType& InValue |
Construct an OptionalType with a valid value. | Misc/Optional.h | |
constexpr TOptional
(
OptionalType&& InValue |
Misc/Optional.h | ||
| Construct an OptionalType with an invalid value. | Misc/Optional.h | ||
| Copy/Move construction | Misc/Optional.h | ||
| Misc/Optional.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
constexpr ~TOptional() |
Misc/Optional.h |
Typedefs
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| ElementType | OptionalType | Misc/Optional.h | |
| FOptional | UE::Core::Private::FOptional | Misc/Optional.h | |
| Super | UE::Core::Private::TOptionalBase< OptionalType > | Misc/Optional.h |
Constants
| Name | Type | Remarks | Include Path |
|---|---|---|---|
| bUsingIntrusiveUnsetState | bool | Misc/Optional.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| FOptional | friend | Misc/Optional.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
OptionalType & Emplace
(
ArgsType&&... Args |
Misc/Optional.h | ||
const OptionalType & Get
(
const OptionalType& DefaultValue |
Misc/Optional.h | ||
OptionalType * GetPtrOrNull () |
Misc/Optional.h | ||
const OptionalType * GetPtrOrNull () |
Misc/Optional.h | ||
const OptionalType & GetValue () |
Misc/Optional.h | ||
OptionalType & GetValue () |
Misc/Optional.h | ||
bool IsSet() |
Misc/Optional.h | ||
void Reset() |
Misc/Optional.h | ||
void Serialize
(
FArchive& Ar |
Misc/Optional.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
constexpr operator bool() |
Misc/Optional.h | ||
OptionalType & operator* () |
Misc/Optional.h | ||
const OptionalType & operator* () |
Misc/Optional.h | ||
| Misc/Optional.h | |||
| Misc/Optional.h | |||
| Misc/Optional.h | |||
| Misc/Optional.h | |||
OptionalType * operator-> () |
Misc/Optional.h | ||
const OptionalType * operator-> () |
Misc/Optional.h |