From 6194efaac45a587846720f678be1331b6c76b393 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Fri, 3 Aug 2018 21:27:40 +0200 Subject: [PATCH] [DEV] add Macro for the Gang of X --- etk/types.hpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/etk/types.hpp b/etk/types.hpp index cdf49e1..91afc28 100644 --- a/etk/types.hpp +++ b/etk/types.hpp @@ -21,6 +21,27 @@ extern "C" { using size_t=uint64_t; #endif #endif + +#define ETK_CONSTRUCTOR_COPY_DEFAULT(ETK_TYPE_CLASS) \ + ETK_TYPE_CLASS(const ETK_TYPE_CLASS& ) = default; \ + ETK_TYPE_CLASS& operator= (const ETK_TYPE_CLASS& ) = default + +#define ETK_CONSTRUCTOR_COPY_DELETE(ETK_TYPE_CLASS) \ + ETK_TYPE_CLASS(const ETK_TYPE_CLASS& ) = delete; \ + ETK_TYPE_CLASS& operator= (const ETK_TYPE_CLASS& ) = delete + +#define ETK_CONSTRUCTOR_MOVE_DEFAULT(ETK_TYPE_CLASS) \ + ETK_TYPE_CLASS(ETK_TYPE_CLASS&& ) = default; \ + ETK_TYPE_CLASS& operator= (ETK_TYPE_CLASS&& ) = default + +#define ETK_CONSTRUCTOR_MOVE_DELETE(ETK_TYPE_CLASS) \ + ETK_TYPE_CLASS(ETK_TYPE_CLASS&& ) = delete; \ + ETK_TYPE_CLASS& operator= (ETK_TYPE_CLASS&& ) = delete + +// DEfine 2 basic type that depend on the machine word size. uint_t is better than size_t because whe have the usigned dual. +using int_t = int; +using uint_t = unsigned int; + #ifndef INT8_MIN #define INT8_MIN (-128) #endif