Kiwano Engine v1.3.x
kiwano::Any类 参考

可储存单个任意对象的容器 更多...

#include <Any.h>

Public 成员函数

template<typename _Ty , typename _Decayed = typename std::decay<_Ty>::type, typename std::enable_if< std::is_copy_constructible< _Decayed >::value, int >::type = 0>
 Any (_Ty &&val)
 
template<typename _Ty , typename... _Args>
 Any (_Args &&... args)
 
 Any (const Any &rhs)
 
 Any (Any &&rhs) noexcept
 
const std::type_info & GetType () const noexcept
 获取含有对象类型
 
bool HasValue () const noexcept
 是否含有对象
 
template<typename _Ty , typename... _Args>
void Emplace (_Args &&... args)
 从参数构造对象
 
void Swap (Any &rhs) noexcept
 交换容器
 
void Clear () noexcept
 销毁所含对象
 
template<typename _Ty >
_Ty * CastPtr () noexcept
 转换为指定类型的指针
 
template<typename _Ty >
const _Ty * CastPtr () const noexcept
 转换为指定类型的指针
 
template<typename _Ty >
_Ty Cast ()
 转换为指定类型 更多...
 
template<typename _Ty >
_Ty Cast () const
 转换为指定类型 更多...
 
Anyoperator= (const Any &rhs)
 
Anyoperator= (Any &&rhs) noexcept
 

详细描述

可储存单个任意对象的容器

成员函数说明

◆ Cast() [1/2]

template<typename _Ty >
_Ty kiwano::Any::Cast ( )
inline

转换为指定类型

异常
std::bad_cast转换失败时抛出

◆ Cast() [2/2]

template<typename _Ty >
_Ty kiwano::Any::Cast ( ) const
inline

转换为指定类型

异常
std::bad_cast转换失败时抛出