engine
 
载入中...
搜索中...
未找到
Public 成员函数 | 友元 | 所有成员列表
TUnion< TypeA, TypeB, TypeC, TypeD, TypeE, TypeF > 模板类 参考

Represents a type which is the union of several other types; i.e. 更多...

#include <Union.h>

Public 成员函数

uint8 GetCurrentSubtypeIndex () const
 
template<typename Subtype >
Subtype & GetSubtype ()
 
template<typename Subtype >
const Subtype & GetSubtype () const
 
template<typename Subtype >
bool HasSubtype () const
 
bool operator== (const TUnion &Other) const
 Equality comparison.
 
void Reset ()
 Sets the union's value to NULL.
 
template<typename Subtype >
void ResetSubtype ()
 If the union's current value is of the given subtype, sets the union's value to a NULL value.
 
template<typename Subtype >
Subtype * SetSubtype (typename TCallTraits< Subtype >::ParamType NewValue)
 Replaces the value of the union with a value of the given subtype.
 
 TUnion ()
 Default constructor.
 
 TUnion (const TUnion &Other)
 Copy constructor.
 
 TUnion (typename TCallTraits< TypeA >::ParamType InValue, TDisambiguater< 0 > Disambiguater=TDisambiguater< 0 >())
 Initialization constructor.
 
 TUnion (typename TCallTraits< TypeB >::ParamType InValue, TDisambiguater< 1 > Disambiguater=TDisambiguater< 1 >())
 Initialization constructor.
 
 TUnion (typename TCallTraits< TypeC >::ParamType InValue, TDisambiguater< 2 > Disambiguater=TDisambiguater< 2 >())
 Initialization constructor.
 
 TUnion (typename TCallTraits< TypeD >::ParamType InValue, TDisambiguater< 3 > Disambiguater=TDisambiguater< 3 >())
 Initialization constructor.
 
 TUnion (typename TCallTraits< TypeE >::ParamType InValue, TDisambiguater< 4 > Disambiguater=TDisambiguater< 4 >())
 Initialization constructor.
 
 TUnion (typename TCallTraits< TypeF >::ParamType InValue, TDisambiguater< 5 > Disambiguater=TDisambiguater< 5 >())
 Initialization constructor.
 
 ~TUnion ()
 Destructor.
 

友元

uint32 GetTypeHash (const TUnion &Union)
 Hash function.
 

详细描述

template<typename TypeA, typename TypeB = FNull, typename TypeC = FNull, typename TypeD = FNull, typename TypeE = FNull, typename TypeF = FNull>
class TUnion< TypeA, TypeB, TypeC, TypeD, TypeE, TypeF >

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.

成员函数说明

◆ GetCurrentSubtypeIndex()

template<typename TypeA , typename TypeB = FNull, typename TypeC = FNull, typename TypeD = FNull, typename TypeE = FNull, typename TypeF = FNull>
uint8 TUnion< TypeA, TypeB, TypeC, TypeD, TypeE, TypeF >::GetCurrentSubtypeIndex ( ) const
inline
返回
The index corresponding to the type currently stored in this union; useful for writing switches and indexing into tables.

◆ GetSubtype() [1/2]

template<typename TypeA , typename TypeB = FNull, typename TypeC = FNull, typename TypeD = FNull, typename TypeE = FNull, typename TypeF = FNull>
template<typename Subtype >
Subtype & TUnion< TypeA, TypeB, TypeC, TypeD, TypeE, TypeF >::GetSubtype ( )
inline
返回
A reference to the union's value of the given subtype. May only be called if the union's HasSubtype()==true for the given subtype.

◆ GetSubtype() [2/2]

template<typename TypeA , typename TypeB = FNull, typename TypeC = FNull, typename TypeD = FNull, typename TypeE = FNull, typename TypeF = FNull>
template<typename Subtype >
const Subtype & TUnion< TypeA, TypeB, TypeC, TypeD, TypeE, TypeF >::GetSubtype ( ) const
inline
返回
A reference to the union's value of the given subtype. May only be called if the union's HasSubtype()==true for the given subtype.

◆ HasSubtype()

template<typename TypeA , typename TypeB = FNull, typename TypeC = FNull, typename TypeD = FNull, typename TypeE = FNull, typename TypeF = FNull>
template<typename Subtype >
bool TUnion< TypeA, TypeB, TypeC, TypeD, TypeE, TypeF >::HasSubtype ( ) const
inline
返回
True if the union's value is of the given subtype.

该类的文档由以下文件生成: