Navigation
API > API/Runtime > API/Runtime/Core > API/Runtime/Core/Misc
References
| Module | Core |
| Header | /Engine/Source/Runtime/Core/Public/Misc/Variant.h |
| Include | #include "Misc/Variant.h" |
Syntax
class FVariant
Remarks
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.
Constructors
| Type | Name | Description | |
|---|---|---|---|
FVariant () |
Default constructor. | ||
FVariant
(
T InValue |
Creates and initializes a new instance with the specified value. | ||
| Creates and initializes a new instance from a byte array. | |||
| Creates and initializes a new instance from a TCHAR string. |
Destructors
| Type | Name | Description | |
|---|---|---|---|
~FVariant () |
Functions
| Type | Name | Description | |
|---|---|---|---|
| void | Empty () |
Empties the value. | |
| const TArray< uint8 > & | GetBytes () |
Gets the stored value as a byte array. | |
| int32 | GetSize () |
Gets the stored value's size (in bytes). | |
| EVariantTypes | GetType () |
Gets the stored value's type. | |
| T | GetValue () |
Gets the stored value. | |
GetValue () |
Gets the stored value for byte arrays. | ||
| bool | IsEmpty () |
Checks whether the value is empty. |
Operators
| Type | Name | Description | |
|---|---|---|---|
operator T () |
Implicit conversion operator. | ||
| bool | operator!=
(
const FVariant& Other |
Comparison operator for inequality. | |
| FVariant & | |||
| FVariant & | |||
| FVariant & | |||
| FVariant & | operator=
(
T InValue |
Assignment operator. | |
| FVariant & | Assignment operator for byte arrays. | ||
| FVariant & | Assignment operator for TCHAR strings. | ||
| bool | operator==
(
const FVariant& Other |
Comparison operator for equality. |