![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
#include <TVariant.h>
Inheritance diagram for TVariant< T, Ts >:Static Public Member Functions | |
| template<typename U > | |
| static constexpr SIZE_T | IndexOfType () |
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.
|
inline |
Default initialize the TVariant to the first type in the parameter pack
|
inlineexplicit |
Perform in-place construction of a type into the variant
|
inline |
Copy construct the variant from another variant of the same type
|
inline |
Move construct the variant from another variant of the same type
|
inlineexplicit |
INTERNAL USE ONLY – Do not call this constructor, it will put the variant in a bad state. Its internal use case is for in-place construction of non-default-constructible types during serialization.
Construct the TVariant to store the specified uninitialized element type. The caller must unconditionally get a pointer to the element and construct an object of the right type in that position. This is all totally exception-unsafe. This relies on undefined behavior by dereferencing a pointer to an object (inside Get) that doesn't exist, and then turning it back to an pointer. Any other attempts to use or destroy the variant before an object of the right type has been constructed is completely unsafe, it may e.g. result in trying to destroy an object that is not there.
|
inline |
Set a specifically-typed value into the variant using in-place construction
|
inline |
Get a reference to the held value. Bad things can happen if this is called on a variant that does not hold the type asked for
Get a reference to the held value. Bad things can happen if this is called on a variant that does not hold the type asked for
|
inline |
Get a reference to the held value if set, otherwise the DefaultValue
Returns the currently held type's index into the template parameter pack
|
inlinestaticconstexpr |
Lookup the index of a type in the template parameter pack at compile time.
|
inline |
Determine if the variant holds the specific type
|
inline |
Copy assign a variant from another variant of the same type
|
inline |
Move assign a variant from another variant of the same type
|
inline |
Set a specifically-typed value into the variant
|
inline |
Set a specifically-typed value into the variant
|
inline |
Get a pointer to the held value if the held type is the same as the one specified
|
inline |
Get a pointer to the held value if the held type is the same as the one specified