engine
 
载入中...
搜索中...
未找到
Public 成员函数 | 静态 Public 成员函数 | 所有成员列表
TVariant< T, Ts > 模板类 参考final

A type-safe union based loosely on std::variant. 更多...

#include <TVariant.h>

+ 类 TVariant< T, Ts > 继承关系图:

Public 成员函数

template<typename U , typename... TArgs>
void Emplace (TArgs &&... Args)
 Set a specifically-typed value into the variant using in-place construction
 
template<typename U >
U & Get ()
 Get a reference to the held value. 更多...
 
template<typename U >
const U & Get () const
 Get a reference to the held value. 更多...
 
SIZE_T GetIndex () const
 Returns the currently held type's index into the template parameter pack
 
template<typename U >
bool IsType () const
 Determine if the variant holds the specific type
 
TVariant & operator= (const TVariant &Other)
 Copy assign a variant from another variant of the same type
 
TVariant & operator= (TVariant &&Other)
 Move assign a variant from another variant of the same type
 
template<typename U >
void Set (const typename TIdentity< U >::Type &Value)
 Set a specifically-typed value into the variant
 
template<typename U >
void Set (typename TIdentity< U >::Type &&Value)
 Set a specifically-typed value into the variant
 
template<typename U >
U * TryGet ()
 Get a pointer to the held value if the held type is the same as the one specified
 
template<typename U >
const U * TryGet () const
 Get a pointer to the held value if the held type is the same as the one specified
 
 TVariant ()
 Default initialize the TVariant to the first type in the parameter pack
 
 TVariant (const TVariant &Other)
 Copy construct the variant from another variant of the same type
 
template<typename U , typename... TArgs>
 TVariant (TInPlaceType< U > &&, TArgs &&... Args)
 Perform in-place construction of a type into the variant
 
 TVariant (TVariant &&Other)
 Move construct the variant from another variant of the same type
 
 ~TVariant ()
 Destruct the underlying type (if appropriate)
 

静态 Public 成员函数

template<typename U >
static constexpr SIZE_T IndexOfType ()
 Lookup the index of a type in the template parameter pack at compile time.
 

详细描述

template<typename T, typename... Ts>
class TVariant< 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.

成员函数说明

◆ Get() [1/2]

template<typename T , typename... Ts>
template<typename U >
U & TVariant< T, Ts >::Get ( )
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() [2/2]

template<typename T , typename... Ts>
template<typename U >
const U & TVariant< T, Ts >::Get ( ) const
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


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