diff --git a/Redcraft.Utility/Source/Public/Templates/Any.h b/Redcraft.Utility/Source/Public/Templates/Any.h index 01ca9c5..6c83f32 100644 --- a/Redcraft.Utility/Source/Public/Templates/Any.h +++ b/Redcraft.Utility/Source/Public/Templates/Any.h @@ -15,29 +15,32 @@ NAMESPACE_MODULE_BEGIN(Utility) // TAny's CustomStorage concept, see FAnyDefaultStorage template -concept CAnyCustomStorage = - CSameAs && - CSameAs && - requires(const T& A) +concept CAnyCustomStorage = CDefaultConstructible + && !CCopyConstructible && !CMoveConstructible + && !CCopyAssignable && !CMoveAssignable + && CDestructible + && CSameAs + && CSameAs + && requires(const T& A) { { A.InlineAllocation() } -> CSameAs; { A.HeapAllocation() } -> CSameAs; { A.TypeInfo() } -> CSameAs; - } && - requires(T& A) + } + && requires(T& A) { { A.InlineAllocation() } -> CSameAs; { A.HeapAllocation() } -> CSameAs; { A.TypeInfo() } -> CSameAs; - } && - 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 diff --git a/Redcraft.Utility/Source/Public/Templates/Atomic.h b/Redcraft.Utility/Source/Public/Templates/Atomic.h index aaf41da..a1390be 100644 --- a/Redcraft.Utility/Source/Public/Templates/Atomic.h +++ b/Redcraft.Utility/Source/Public/Templates/Atomic.h @@ -54,7 +54,7 @@ NAMESPACE_PRIVATE_END template requires (CTriviallyCopyable && CCopyConstructible && CMoveConstructible && CCopyAssignable && CMoveAssignable) -struct TAtomic : public FSingleton +struct TAtomic : FSingleton { protected: @@ -233,7 +233,7 @@ using TAtomicRef = TAtomic; template TAtomic(T) -> TAtomic; -struct FAtomicFlag : public FSingleton +struct FAtomicFlag : FSingleton { public: diff --git a/Redcraft.Utility/Source/Public/Templates/Function.h b/Redcraft.Utility/Source/Public/Templates/Function.h index 2a53dbf..b7bc1e8 100644 --- a/Redcraft.Utility/Source/Public/Templates/Function.h +++ b/Redcraft.Utility/Source/Public/Templates/Function.h @@ -149,7 +149,7 @@ private: }; template - struct alignas(16) FFunctionStorage + struct alignas(16) FFunctionStorage : FSingleton { //~ Begin CAnyCustomStorage Interface inline static constexpr size_t InlineSize = 64 - sizeof(uintptr) - sizeof(CallableType); diff --git a/Redcraft.Utility/Source/Public/Templates/Noncopyable.h b/Redcraft.Utility/Source/Public/Templates/Noncopyable.h index 36346ff..7b5b45a 100644 --- a/Redcraft.Utility/Source/Public/Templates/Noncopyable.h +++ b/Redcraft.Utility/Source/Public/Templates/Noncopyable.h @@ -20,7 +20,15 @@ struct FNonmovable FNonmovable& operator=(FNonmovable&&) = delete; }; -struct FSingleton : public FNoncopyable, public FNonmovable { }; +// Multiple inheritance is no longer used here, as that would break the EBO in MSVC +struct FSingleton // : FNoncopyable, FNonmovable +{ + FSingleton() = default; + FSingleton(const FSingleton&) = delete; + FSingleton(FSingleton&&) = delete; + FSingleton& operator=(const FSingleton&) = delete; + FSingleton& operator=(FSingleton&&) = delete; +}; NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Redcraft)