Explorar el Código

common: common_funcs: Add helper macros for non-copyable and non-moveable.

- Useful for scenarios where we do not want to inherit from NonCopyable.
bunnei hace 5 años
padre
commit
b99fc70191
Se han modificado 1 ficheros con 8 adiciones y 0 borrados
  1. 8 0
      src/common/common_funcs.h

+ 8 - 0
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.