41 typename =
typename std::enable_if<!std::is_same<typename std::decay<T>::type,
TTKAny>::value,
T>::type>
44 m_type(typeid(typename
std::decay<
T>::type))
52 bool isNull()
const noexcept;
60 return m_type == std::type_index(
typeid(
T));
104 virtual const char *
what()
const noexcept override final
106 return "bad any cast";
116 virtual ~
_Base() =
default;
118 virtual _BasePtr clone()
const noexcept = 0;
121 template <
typename T>
124 template <
typename U>
126 : m_value(
std::forward<U>(value))
144 return m_ptr ? m_ptr->
clone() :
nullptr;
154 # define TTKAnyCast(x, y) (TTK::any_cast<x>(y))
156 # define TTKAnyCast(x, y) ((x)(y))
168 template <
typename T,
typename... Args>
171 return TTKAny(
T(std::forward<Args>(args)...));
174 template <
typename T>
175 using remove_cvr =
typename std::remove_cv<typename std::remove_reference<T>::type>::type;
180 template <
typename T,
typename _TYPE = remove_cvr<T>>
183 return other.
isSame<_TYPE>() ? other.
cast<_TYPE>() : _TYPE();
188 template <
typename T,
typename _TYPE = remove_cvr<T>>
191 return other.
isSame<_TYPE>() ? other.
cast<_TYPE>() : _TYPE();
196 template <
typename T,
typename _TYPE = remove_cvr<T>>
199 return other.isSame<_TYPE>() ? other.cast<_TYPE>() : _TYPE();
204 template <
typename T,
typename _TYPE = remove_cvr<T>>
207 return other->isSame<_TYPE>() ? other->cast<_TYPE>() : _TYPE();
212 template <
typename T,
typename _TYPE = remove_cvr<T>>
215 return other->isSame<_TYPE>() ? other->cast<_TYPE>() : _TYPE();
#define TTKStaticCast(x, y)
#define TTK_MODULE_EXPORT
#define TTKConstCast(x, y)
std::unique_ptr< _Base > _BasePtr
_Derived(U &&value) noexcept
void swap(TTKAny &other) noexcept
_BasePtr clone() const noexcept
bool isSame() const noexcept
void swap(TTKAny &left, TTKAny &right) noexcept
TTKAny(T &&value) noexcept
typename std::remove_cv< typename std::remove_reference< T >::type >::type remove_cvr
_Tp exchange(_Tp &__obj, _Up &&__new_val) noexcept
Assign __new_val to __obj and return its previous value.
The namespace of the application object.
TTKAny make_any(Args &&...args)
_TYPE any_cast(const TTKAny &other)
The class of the ttk any module.
virtual _BasePtr clone() const noexceptoverridefinal
virtual const char * what() const noexceptoverridefinal
#define TTKDynamicCast(x, y)