From 764c01832db86cd8bcbc390038a29eb38e62ff7e Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Mon, 14 Oct 2019 09:06:48 -0700 Subject: [PATCH] Use C++11 member-delete in NO_COPY_CLASS/NO_ASSIGN_CLASS macros --- include/wx/defs.h | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/include/wx/defs.h b/include/wx/defs.h index e1b95a68b4..f35b9eea8a 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -2994,24 +2994,30 @@ typedef const void* WXWidget; /* macros to define a class without copy ctor nor assignment operator */ /* --------------------------------------------------------------------------- */ +#if defined(__cplusplus) && __cplusplus >= 201103L + #define wxMEMBER_DELETE = delete +#else + #define wxMEMBER_DELETE +#endif + #define wxDECLARE_NO_COPY_CLASS(classname) \ private: \ - classname(const classname&); \ - classname& operator=(const classname&) + classname(const classname&) wxMEMBER_DELETE; \ + classname& operator=(const classname&) wxMEMBER_DELETE #define wxDECLARE_NO_COPY_TEMPLATE_CLASS(classname, arg) \ private: \ - classname(const classname&); \ - classname& operator=(const classname&) + classname(const classname&) wxMEMBER_DELETE; \ + classname& operator=(const classname&) wxMEMBER_DELETE #define wxDECLARE_NO_COPY_TEMPLATE_CLASS_2(classname, arg1, arg2) \ private: \ - classname(const classname&); \ - classname& operator=(const classname&) + classname(const classname&) wxMEMBER_DELETE; \ + classname& operator=(const classname&) wxMEMBER_DELETE #define wxDECLARE_NO_ASSIGN_CLASS(classname) \ private: \ - classname& operator=(const classname&) + classname& operator=(const classname&) wxMEMBER_DELETE /* deprecated variants _not_ requiring a semicolon after them */ #define DECLARE_NO_COPY_CLASS(classname) \