Navigation
API > API/Runtime > API/Runtime/Core > API/Runtime/Core/Containers
Inheritance Hierarchy
- TUnion
- FGameFeatureProtocolOptions
References
| Module | Core |
| Header | /Engine/Source/Runtime/Core/Public/Containers/Union.h |
| Include | #include "Containers/Union.h" |
Syntax
template<typename TypeA, typename TypeB, typename TypeC, typename TypeD, typename TypeE, typename TypeF>
class TUnion
Remarks
Represents a type which is the union of several other types; i.e. it can have a value whose type is of any the union's subtypes. This differs from C union types by being type-safe, and supporting non-trivial data types as subtypes. Since a value for the union must be of a single subtype, the union stores potential values of different subtypes in overlapped memory, and keeps track of which one is currently valid.
TUnion should be considered deprecated and TVariant should be used instead for new code.
Variables
| Type | Name | Description | |
|---|---|---|---|
| TTypeCompatibleBytes< TypeA > | A | ||
| TTypeCompatibleBytes< TypeB > | B | ||
| TTypeCompatibleBytes< TypeC > | C | ||
| TTypeCompatibleBytes< TypeD > | D | ||
| TTypeCompatibleBytes< TypeE > | E | ||
| TTypeCompatibleBytes< TypeF > | F |
Constructors
| Type | Name | Description | |
|---|---|---|---|
TUnion () |
Default constructor. | ||
| Copy constructor. | |||
TUnion
(
typename TCallTraits< TypeA >::ParamType InValue, |
Initialization constructor. | ||
TUnion
(
typename TCallTraits< TypeB >::ParamType InValue, |
Initialization constructor. | ||
TUnion
(
typename TCallTraits< TypeC >::ParamType InValue, |
Initialization constructor. | ||
TUnion
(
typename TCallTraits< TypeD >::ParamType InValue, |
Initialization constructor. | ||
TUnion
(
typename TCallTraits< TypeE >::ParamType InValue, |
Initialization constructor. | ||
TUnion
(
typename TCallTraits< TypeF >::ParamType InValue, |
Initialization constructor. |
Destructors
| Type | Name | Description | |
|---|---|---|---|
~TUnion () |
Destructor. |
Functions
| Type | Name | Description | |
|---|---|---|---|
| uint8 | |||
| const Subtype & | GetSubtype () |
||
| Subtype & | GetSubtype () |
||
| bool | HasSubtype () |
||
| void | Reset () |
Sets the union's value to NULL. | |
| void | ResetSubtype () |
If the union's current value is of the given subtype, sets the union's value to a NULL value. | |
| void | |||
| Subtype * | SetSubtype () |
Replaces the value of the union with a value of the given subtype. | |
| Subtype * | SetSubtype
(
typename TCallTraits< Subtype >::ParamType NewValue |
Replaces the value of the union with a value of the given subtype. |
Operators
| Type | Name | Description | |
|---|---|---|---|
| TUnion & | |||
| bool | operator==
(
const TUnion& Other |
Equality comparison. |