fix(templates): fix FNoncopyable to satisfy the CMovable concept

This commit is contained in:
_Redstone_c_ 2023-02-17 23:31:24 +08:00
parent bae95fa438
commit f521c2b5d5

View File

@ -9,17 +9,21 @@ NAMESPACE_MODULE_BEGIN(Utility)
/** A class indicates that a derived class cannot be copied. */ /** A class indicates that a derived class cannot be copied. */
struct FNoncopyable struct FNoncopyable
{ {
FNoncopyable() = default; FNoncopyable() = default;
FNoncopyable(const FNoncopyable&) = delete; FNoncopyable(const FNoncopyable&) = delete;
FNoncopyable(FNoncopyable&&) = default;
FNoncopyable& operator=(const FNoncopyable&) = delete; FNoncopyable& operator=(const FNoncopyable&) = delete;
FNoncopyable& operator=(FNoncopyable&&) = default;
}; };
/** A class indicates that a derived class cannot be moved. */ /** A class indicates that a derived class cannot be moved. */
struct FNonmovable struct FNonmovable
{ {
FNonmovable() = default; FNonmovable() = default;
FNonmovable(FNonmovable&&) = delete; FNonmovable(const FNonmovable&) = default;
FNonmovable& operator=(FNonmovable&&) = delete; FNonmovable(FNonmovable&&) = delete;
FNonmovable& operator=(const FNonmovable&) = default;
FNonmovable& operator=(FNonmovable&&) = delete;
}; };
/** A class indicates that a derived class cannot be copied or moved. */ /** A class indicates that a derived class cannot be copied or moved. */
@ -27,11 +31,11 @@ struct FSingleton // : FNoncopyable, FNonmovable
{ {
// NOTE: Multiple inheritance is no longer used here, as that would break the EBO in MSVC // NOTE: Multiple inheritance is no longer used here, as that would break the EBO in MSVC
FSingleton() = default; FSingleton() = default;
FSingleton(const FSingleton&) = delete; FSingleton(const FSingleton&) = delete;
FSingleton(FSingleton&&) = delete; FSingleton(FSingleton&&) = delete;
FSingleton& operator=(const FSingleton&) = delete; FSingleton& operator=(const FSingleton&) = delete;
FSingleton& operator=(FSingleton&&) = delete; FSingleton& operator=(FSingleton&&) = delete;
}; };
NAMESPACE_MODULE_END(Utility) NAMESPACE_MODULE_END(Utility)