feat(templates): add CAnyCustomStorage for TAny

This commit is contained in:
2022-11-14 21:05:53 +08:00
parent 9ff3b1c583
commit 226f5a34e9
2 changed files with 30 additions and 14 deletions

View File

@ -83,7 +83,7 @@ template <typename Ret, typename... Types> struct TFunctionInfo<Ret(Types...) co
template <typename CallableType>
struct alignas(16) FFunctionStorage
{
//~ Begin CAnyStorage Interface
//~ Begin CAnyCustomStorage Interface
inline static constexpr size_t InlineSize = 64 - sizeof(uintptr) - sizeof(CallableType);
inline static constexpr size_t InlineAlignment = 16;
constexpr void* InlineAllocation() { return &InlineAllocationImpl; }
@ -94,7 +94,7 @@ struct alignas(16) FFunctionStorage
constexpr uintptr TypeInfo() const { return TypeInfoImpl; }
constexpr void CopyCustom(const FFunctionStorage& InValue) { Callable = InValue.Callable; }
constexpr void MoveCustom( FFunctionStorage&& InValue) { Callable = InValue.Callable; }
//~ End CAnyStorage Interface
//~ End CAnyCustomStorage Interface
union
{
@ -106,9 +106,6 @@ struct alignas(16) FFunctionStorage
CallableType Callable;
template <CAnyStorage T>
friend struct TAny;
};
template <typename F, typename CVRef, bool bIsRef> struct TFunctionImpl;