Redcraft/Redcraft.Utility/Source/Public/Templates/Noncopyable.h
_Redstone_c_ 6a70d4273e fix(templates): fix FSingleton not working correctly with EBO on MSVC
make CAnyCustomStorage satisfy the concept of FSingleton
2022-11-18 23:18:58 +08:00

36 lines
845 B
C

#pragma once
#include "CoreTypes.h"
NAMESPACE_REDCRAFT_BEGIN
NAMESPACE_MODULE_BEGIN(Redcraft)
NAMESPACE_MODULE_BEGIN(Utility)
struct FNoncopyable
{
FNoncopyable() = default;
FNoncopyable(const FNoncopyable&) = delete;
FNoncopyable& operator=(const FNoncopyable&) = delete;
};
struct FNonmovable
{
FNonmovable() = default;
FNonmovable(FNonmovable&&) = delete;
FNonmovable& operator=(FNonmovable&&) = delete;
};
// 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)
NAMESPACE_REDCRAFT_END