Navigation
API > API/Runtime > API/Runtime/Core
Implements an extensible union of multiple types.
Variant types can be used to store a range of different built-in types, as well as user defined types. The values are internally serialized into a byte array, which means that only FArchive serializable types are supported at this time.
| Name | FVariant |
| Type | class |
| Header File | /Engine/Source/Runtime/Core/Public/Misc/Variant.h |
| Include Path | #include "Misc/Variant.h" |
Syntax
class FVariant
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FVariant
(
const TCHAR* InString |
Creates and initializes a new instance from a TCHAR string. | Misc/Variant.h | |
| Misc/Variant.h | |||
| Creates and initializes a new instance from a byte array. | Misc/Variant.h | ||
FVariant
(
T InValue |
Creates and initializes a new instance with the specified value. | Misc/Variant.h | |
| Misc/Variant.h | |||
FVariant () |
Default constructor. | Misc/Variant.h | |
| Misc/Variant.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~FVariant() |
Misc/Variant.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| Type | EVariantTypes | Holds the type of the variant. | Misc/Variant.h | |
| Value | TArray< uint8 > | Holds the serialized value. | Misc/Variant.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
void Empty () |
Empties the value. | Misc/Variant.h | |
| Gets the stored value as a byte array. | Misc/Variant.h | ||
int32 GetSize () |
Gets the stored value's size (in bytes). | Misc/Variant.h | |
| Gets the stored value's type. | Misc/Variant.h | ||
T GetValue () |
Gets the stored value. | Misc/Variant.h | |
| Gets the stored value for byte arrays. | Misc/Variant.h | ||
bool IsEmpty () |
Checks whether the value is empty. | Misc/Variant.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
operator T() |
Implicit conversion operator. | Misc/Variant.h | |
bool operator!=
(
const FVariant& Other |
Comparison operator for inequality. | Misc/Variant.h | |
| Misc/Variant.h | |||
| Misc/Variant.h | |||
| Misc/Variant.h | |||
| Assignment operator. | Misc/Variant.h | ||
| Assignment operator for byte arrays. | Misc/Variant.h | ||
| Assignment operator for TCHAR strings. | Misc/Variant.h | ||
bool operator==
(
const FVariant& Other |
Comparison operator for equality. | Misc/Variant.h |