TUnion

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.

Variables

Name Description

Public variable

TTypeCompatible ...

 

A

Public variable

TTypeCompatible ...

 

B

Public variable

TTypeCompatible ...

 

C

Public variable

TTypeCompatible ...

 

D

Public variable

TTypeCompatible ...

 

E

Public variable

TTypeCompatible ...

 

F

Constructors

Name Description

Public function

TUnion()

Default constructor.

Public function

TUnion

(
    const TUnion & Other
)

Copy constructor.

Public function

TUnion

(
    typename TCallTraits < TypeA >::Para...,
    TDisambiguater < 0 > Disambiguater
)

Initialization constructor.

Public function

TUnion

(
    typename TCallTraits < TypeB >::Para...,
    TDisambiguater < 1 > Disambiguater
)

Initialization constructor.

Public function

TUnion

(
    typename TCallTraits < TypeC >::Para...,
    TDisambiguater < 2 > Disambiguater
)

Initialization constructor.

Public function

TUnion

(
    typename TCallTraits < TypeD >::Para...,
    TDisambiguater < 3 > Disambiguater
)

Initialization constructor.

Public function

TUnion

(
    typename TCallTraits < TypeE >::Para...,
    TDisambiguater < 4 > Disambiguater
)

Initialization constructor.

Public function

TUnion

(
    typename TCallTraits < TypeF >::Para...,
    TDisambiguater < 5 > Disambiguater
)

Initialization constructor.

Destructors

Name Description

Public function

~TUnion()

Destructor.

Functions

Name Description

Public function Const

const Subtyp...

 

GetSubtype()

Public function

Subtype &

 

GetSubtype()

Public function Const

bool

 

HasSubtype()

Public function

void

 

Reset()

Sets the union's value to NULL.

Public function

void

 

ResetSubtype()

If the union's current value is of the given subtype, sets the union's value to a NULL value.

Public function

Subtype *...

 

SetSubtype

(
    typename TCallTraits < Subtype >::Pa...
)

Replaces the value of the union with a value of the given subtype.

Operators

Name Description

Public function Const

bool

 

operator==

(
    const TUnion & Other
)

Equality comparison.

References

Module

Core

Header

Runtime/Core/Public/Containers/Union.h