summaryrefslogtreecommitdiff
path: root/src/basicmacros.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/basicmacros.h')
-rw-r--r--src/basicmacros.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/basicmacros.h b/src/basicmacros.h
index 05987e32f..cebf06043 100644
--- a/src/basicmacros.h
+++ b/src/basicmacros.h
@@ -30,4 +30,12 @@ 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.
+// 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 &); \
+ C &operator=(const C &)
+
#endif