2022-02-03 08:45:34 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "CoreTypes.h"
|
|
|
|
|
|
|
|
NAMESPACE_REDCRAFT_BEGIN
|
|
|
|
NAMESPACE_MODULE_BEGIN(Redcraft)
|
|
|
|
NAMESPACE_MODULE_BEGIN(Utility)
|
|
|
|
|
2022-12-29 13:55:02 +00:00
|
|
|
/** A class indicates that a derived class cannot be copied. */
|
2022-02-03 08:45:34 +00:00
|
|
|
struct FNoncopyable
|
|
|
|
{
|
2023-02-17 15:31:24 +00:00
|
|
|
FNoncopyable() = default;
|
|
|
|
FNoncopyable(const FNoncopyable&) = delete;
|
|
|
|
FNoncopyable(FNoncopyable&&) = default;
|
2022-02-03 08:45:34 +00:00
|
|
|
FNoncopyable& operator=(const FNoncopyable&) = delete;
|
2023-02-17 15:31:24 +00:00
|
|
|
FNoncopyable& operator=(FNoncopyable&&) = default;
|
2022-02-03 08:45:34 +00:00
|
|
|
};
|
|
|
|
|
2022-12-29 13:55:02 +00:00
|
|
|
/** A class indicates that a derived class cannot be moved. */
|
2022-02-03 08:45:34 +00:00
|
|
|
struct FNonmovable
|
|
|
|
{
|
2023-02-17 15:31:24 +00:00
|
|
|
FNonmovable() = default;
|
|
|
|
FNonmovable(const FNonmovable&) = default;
|
|
|
|
FNonmovable(FNonmovable&&) = delete;
|
|
|
|
FNonmovable& operator=(const FNonmovable&) = default;
|
|
|
|
FNonmovable& operator=(FNonmovable&&) = delete;
|
2022-02-03 08:45:34 +00:00
|
|
|
};
|
|
|
|
|
2022-12-29 13:55:02 +00:00
|
|
|
/** A class indicates that a derived class cannot be copied or moved. */
|
2022-11-18 15:17:54 +00:00
|
|
|
struct FSingleton // : FNoncopyable, FNonmovable
|
|
|
|
{
|
2022-12-29 13:55:02 +00:00
|
|
|
// NOTE: Multiple inheritance is no longer used here, as that would break the EBO in MSVC
|
|
|
|
|
2023-02-17 15:31:24 +00:00
|
|
|
FSingleton() = default;
|
|
|
|
FSingleton(const FSingleton&) = delete;
|
|
|
|
FSingleton(FSingleton&&) = delete;
|
2022-11-18 15:17:54 +00:00
|
|
|
FSingleton& operator=(const FSingleton&) = delete;
|
2023-02-17 15:31:24 +00:00
|
|
|
FSingleton& operator=(FSingleton&&) = delete;
|
2022-11-18 15:17:54 +00:00
|
|
|
};
|
2022-02-03 08:45:34 +00:00
|
|
|
|
|
|
|
NAMESPACE_MODULE_END(Utility)
|
|
|
|
NAMESPACE_MODULE_END(Redcraft)
|
|
|
|
NAMESPACE_REDCRAFT_END
|