From 1f1f766e4d00bb3a3a52ebde5ebfa339bc85aa0d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 25 Apr 2024 17:00:16 +0200 Subject: [PATCH] Add wxDECLARE_DEFAULT_COPY[_AND_DEF]() for 3.2 compatibility These macros are not used in this version, but define them just in case people use them in their own code (they shouldn't, but they probably will) when using wx 3.2 where they have been added in 5c249cbca9 (Explicitly define copy ctors etc in classes with virtual dtors, 2024-04-25). See #24502. --- include/wx/defs.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/wx/defs.h b/include/wx/defs.h index 5359e120fc..f877d330d3 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -3042,11 +3042,25 @@ typedef const void* WXWidget; /* macros to define a class without copy ctor nor assignment operator */ /* --------------------------------------------------------------------------- */ +/* Obsolete macros kept only for compatibility, just use the corresponding + C++11 keywords directly in the class definition when writing new code. */ #define wxMEMBER_DELETE = delete + +/* Also note that these macro do _not_ require a semicolon after them for + compatibility with wxWidgets 3.2. */ #define wxDECLARE_DEFAULT_COPY_CTOR(classname) \ public: \ classname(const classname&) = default; +#define wxDECLARE_DEFAULT_COPY(classname) \ + wxDECLARE_DEFAULT_COPY_CTOR(classname) \ + classname& operator=(const classname&) = default; + +#define wxDECLARE_DEFAULT_COPY_AND_DEF(classname) \ + classname() = default; \ + wxDECLARE_DEFAULT_COPY(classname); + +/* These macros do require a semicolon after them. */ #define wxDECLARE_NO_COPY_CLASS(classname) \ private: \ classname(const classname&) wxMEMBER_DELETE; \