fix(templates): fix FSingleton not working correctly with EBO on MSVC

make CAnyCustomStorage satisfy the concept of FSingleton
This commit is contained in:
2022-11-18 23:17:54 +08:00
parent a4ac19673f
commit 6a70d4273e
4 changed files with 24 additions and 13 deletions

View File

@ -15,29 +15,32 @@ NAMESPACE_MODULE_BEGIN(Utility)
// TAny's CustomStorage concept, see FAnyDefaultStorage
template <typename T>
concept CAnyCustomStorage =
CSameAs<decltype(T::InlineSize), const size_t> &&
CSameAs<decltype(T::InlineAlignment), const size_t> &&
requires(const T& A)
concept CAnyCustomStorage = CDefaultConstructible<T>
&& !CCopyConstructible<T> && !CMoveConstructible<T>
&& !CCopyAssignable<T> && !CMoveAssignable<T>
&& CDestructible<T>
&& CSameAs<decltype(T::InlineSize), const size_t>
&& CSameAs<decltype(T::InlineAlignment), const size_t>
&& requires(const T& A)
{
{ A.InlineAllocation() } -> CSameAs<const void*>;
{ A.HeapAllocation() } -> CSameAs<void*>;
{ A.TypeInfo() } -> CSameAs<uintptr>;
} &&
requires(T& A)
}
&& requires(T& A)
{
{ A.InlineAllocation() } -> CSameAs<void*>;
{ A.HeapAllocation() } -> CSameAs<void*&>;
{ A.TypeInfo() } -> CSameAs<uintptr&>;
} &&
requires(T& A, const T& B, T&& C)
}
&& requires(T& A, const T& B, T&& C)
{
A.CopyCustom(B);
A.MoveCustom(MoveTemp(C));
};
// TAny's default storage structure
struct alignas(16) FAnyDefaultStorage
struct alignas(16) FAnyDefaultStorage : FSingleton
{
// The built-in copy/move operators are disabled and CopyCustom/MoveCustom is used instead of them