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));
80 throw std::bad_cast();
106 virtual ~
_Base() noexcept =
default;
108 virtual _BasePtr clone()
const noexcept = 0;
111 template <
typename T>
114 template <
typename U>
116 : m_value(
std::forward<U>(value))
133 return m_ptr ? m_ptr->
clone() :
nullptr;
143 # define TTKAnyCast(x, y) (TTK::any_cast<x>(y))
145 # define TTKAnyCast(x, y) ((x)(y))
157 template <
typename T,
typename... Args>
160 return TTKAny(
T(std::forward<Args>(args)...));
163 template <
typename T>
164 using remove_cvr =
typename std::remove_cv<typename std::remove_reference<T>::type>::type;
169 template <
typename T,
typename _TYPE = remove_cvr<T>>
172 return other.
isSame<_TYPE>() ? other.
cast<_TYPE>() : _TYPE();
177 template <
typename T,
typename _TYPE = remove_cvr<T>>
180 return other.
isSame<_TYPE>() ? other.
cast<_TYPE>() : _TYPE();
185 template <
typename T,
typename _TYPE = remove_cvr<T>>
188 return other.isSame<_TYPE>() ? other.cast<_TYPE>() : _TYPE();
193 template <
typename T,
typename _TYPE = remove_cvr<T>>
196 return other->isSame<_TYPE>() ? other->cast<_TYPE>() : _TYPE();
201 template <
typename T,
typename _TYPE = remove_cvr<T>>
204 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 process utils.
TTKAny make_any(Args &&...args)
_TYPE any_cast(const TTKAny &other)
The class of the ttk any module.
virtual _BasePtr clone() const noexceptoverridefinal
#define TTKDynamicCast(x, y)