Use C++11 member-delete in NO_COPY_CLASS/NO_ASSIGN_CLASS macros

This commit is contained in:
Paul Cornett 2019-10-14 09:06:48 -07:00
parent 05e0fad687
commit 764c01832d

View File

@ -2994,24 +2994,30 @@ typedef const void* WXWidget;
/* macros to define a class without copy ctor nor assignment operator */ /* 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) \ #define wxDECLARE_NO_COPY_CLASS(classname) \
private: \ private: \
classname(const classname&); \ classname(const classname&) wxMEMBER_DELETE; \
classname& operator=(const classname&) classname& operator=(const classname&) wxMEMBER_DELETE
#define wxDECLARE_NO_COPY_TEMPLATE_CLASS(classname, arg) \ #define wxDECLARE_NO_COPY_TEMPLATE_CLASS(classname, arg) \
private: \ private: \
classname(const classname<arg>&); \ classname(const classname<arg>&) wxMEMBER_DELETE; \
classname& operator=(const classname<arg>&) classname& operator=(const classname<arg>&) wxMEMBER_DELETE
#define wxDECLARE_NO_COPY_TEMPLATE_CLASS_2(classname, arg1, arg2) \ #define wxDECLARE_NO_COPY_TEMPLATE_CLASS_2(classname, arg1, arg2) \
private: \ private: \
classname(const classname<arg1, arg2>&); \ classname(const classname<arg1, arg2>&) wxMEMBER_DELETE; \
classname& operator=(const classname<arg1, arg2>&) classname& operator=(const classname<arg1, arg2>&) wxMEMBER_DELETE
#define wxDECLARE_NO_ASSIGN_CLASS(classname) \ #define wxDECLARE_NO_ASSIGN_CLASS(classname) \
private: \ private: \
classname& operator=(const classname&) classname& operator=(const classname&) wxMEMBER_DELETE
/* deprecated variants _not_ requiring a semicolon after them */ /* deprecated variants _not_ requiring a semicolon after them */
#define DECLARE_NO_COPY_CLASS(classname) \ #define DECLARE_NO_COPY_CLASS(classname) \