| TVariantStorage
|
Module |
|
Header |
/Engine/Source/Runtime/Core/Public/Misc/TVariant.h |
Include |
#include "Misc/TVariant.h" |
template<typename T, typename... Ts>
class TVariant : private UE4Variant_Details::TVariantStorage< T, Ts... >
A type-safe union based loosely on std::variant. This flavor of variant requires that all the types in the declaring template parameter pack be unique. Attempting to use the value of a Get() when the underlying type is different leads to undefined behavior.
Name | Description | |
---|---|---|
|
TVariant() |
Default initialize the TVariant to the first type in the parameter pack |
|
TVariant ( |
Copy construct the variant from another variant of the same type |
|
TVariant ( |
Move construct the variant from another variant of the same type |
|
TVariant ( |
Perform in-place construction of a type into the variant |
Name | Description | |
---|---|---|
|
~TVariant() |
Destruct the underlying type (if appropriate) |
Name | Description | ||
---|---|---|---|
|
Emplace ( |
Set a specifically-typed value into the variant using in-place construction |
|
|
U & |
Get() |
Get a reference to the held value. |
|
const U & |
Get() |
Get a reference to the held value. |
|
GetIndex() |
Returns the currently held type's index into the template parameter pack |
|
|
constexpr SI... |
IndexOfType() |
Lookup the index of a type in the template parameter pack at compile time. |
|
IsType() |
Determine if the variant holds the specific type |
|
|
Set ( |
Set a specifically-typed value into the variant |
|
|
Set ( |
Set a specifically-typed value into the variant |
|
|
U * |
TryGet() |
Get a pointer to the held value if the held type is the same as the one specified |
|
const U *... |
TryGet() |
Get a pointer to the held value if the held type is the same as the one specified |