30#include <TGUI/Config.hpp>
35#if TGUI_COMPILED_WITH_CPP_VER >= 17
41#if TGUI_COMPILED_WITH_CPP_VER >= 17
45 T AnyCast(
const Any& obj)
47 return std::any_cast<T>(obj);
53 using StorageType =
typename std::decay<T>::type;
57 return ptr ==
nullptr;
62 return ptr !=
nullptr;
67 : ptr{new Derived<StorageType<U>>(std::forward<U>(value))}
74 typedef StorageType<U> T;
75 return (
dynamic_cast<Derived<T>*
>(ptr) !=
nullptr);
79 StorageType<U>& as()
const
81 typedef StorageType<U> T;
82 auto derived =
dynamic_cast<Derived<T>*
>(ptr);
84 throw std::bad_cast();
86 return derived->value;
92 return as<StorageType<U>>();
105 Any(Any&& that) noexcept
111 Any& operator=(
const Any& a)
126 Any& operator=(Any&& a)
noexcept
131 std::swap(ptr, a.ptr);
145 virtual Base* clone()
const = 0;
149 struct Derived : Base
153 value(std::forward<U>(val))
157 Base* clone()
const override
159 return new Derived<T>(value);
177 T AnyCast(
const Any& obj)
Namespace that contains all TGUI functions and classes.
Definition AbsoluteOrRelativeValue.hpp:36