8#ifndef SkAnySubclass_DEFINED
9#define SkAnySubclass_DEFINED
24template <
typename Base,
size_t Size>
37 template <
typename T,
typename... Args>
39 static_assert(std::is_base_of_v<Base, T>);
40 static_assert(
sizeof(
T) <=
Size);
42 static_assert(std::has_virtual_destructor_v<Base> || std::is_trivially_destructible_v<T>);
44 new (fData)
T(std::forward<Args>(
args)...);
55 const Base*
get()
const {
57 return std::launder(
reinterpret_cast<const Base*
>(fData));
62 return std::launder(
reinterpret_cast<Base*
>(fData));
69 alignas(8) std::byte fData[
Size];
SkAnySubclass & operator=(SkAnySubclass &&)=delete
SkAnySubclass & operator=(const SkAnySubclass &)=delete
void emplace(Args &&... args)
SkAnySubclass(const SkAnySubclass &)=delete
SkAnySubclass(SkAnySubclass &&)=delete
const Base * operator->() const
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args