aboutsummaryrefslogtreecommitdiff
path: root/src/util/basic_macros.h
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2022-05-02 20:55:04 +0200
committersfan5 <sfan5@live.de>2022-05-02 20:56:06 +0200
commite7659883cc6fca343785da2a1af3890ae273abbf (patch)
treeb8d2e3bdbe10ed0e99074207113e24ccca3fb5df /src/util/basic_macros.h
parent663c9364289dae45aeb86a87cba826f577d84a9c (diff)
downloadminetest-e7659883cc6fca343785da2a1af3890ae273abbf.tar.gz
minetest-e7659883cc6fca343785da2a1af3890ae273abbf.tar.bz2
minetest-e7659883cc6fca343785da2a1af3890ae273abbf.zip
Async environment for mods to do concurrent tasks (#11131)
Diffstat (limited to 'src/util/basic_macros.h')
-rw-r--r--src/util/basic_macros.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/util/basic_macros.h b/src/util/basic_macros.h
index 334e342e0..3910c6185 100644
--- a/src/util/basic_macros.h
+++ b/src/util/basic_macros.h
@@ -29,13 +29,19 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#define CONTAINS(c, v) (std::find((c).begin(), (c).end(), (v)) != (c).end())
// To disable copy constructors and assignment operations for some class
-// 'Foobar', add the macro DISABLE_CLASS_COPY(Foobar) as a private member.
+// 'Foobar', add the macro DISABLE_CLASS_COPY(Foobar) in the class definition.
// Note this also disables copying for any classes derived from 'Foobar' as well
// as classes having a 'Foobar' member.
#define DISABLE_CLASS_COPY(C) \
C(const C &) = delete; \
C &operator=(const C &) = delete;
+// If you have used DISABLE_CLASS_COPY with a class but still want to permit moving
+// use this macro to add the default move constructors back.
+#define ALLOW_CLASS_MOVE(C) \
+ C(C &&other) = default; \
+ C &operator=(C &&) = default;
+
#ifndef _MSC_VER
#define UNUSED_ATTRIBUTE __attribute__ ((unused))
#else