From b99fc701912e7ef87a6c1a7aca7ec285279da43a Mon Sep 17 00:00:00 2001 From: bunnei Date: Wed, 31 Mar 2021 14:19:26 -0700 Subject: [PATCH] common: common_funcs: Add helper macros for non-copyable and non-moveable. - Useful for scenarios where we do not want to inherit from NonCopyable. --- src/common/common_funcs.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index 4ace2cd339..73c8c9354e 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h @@ -108,6 +108,14 @@ __declspec(dllimport) void __stdcall DebugBreak(void); } \ } +#define NON_COPYABLE(cls) \ + cls(const cls&) = delete; \ + cls& operator=(const cls&) = delete + +#define NON_MOVEABLE(cls) \ + cls(cls&&) = delete; \ + cls& operator=(cls&&) = delete + #define R_SUCCEEDED(res) (res.IsSuccess()) /// Evaluates an expression that returns a result, and returns the result if it would fail.