summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Midvidy <amidvidy@gmail.com>2015-05-18 10:31:48 -0400
committerAdam Midvidy <amidvidy@gmail.com>2015-05-18 10:31:48 -0400
commitd31bf41e161177d933bcac782a3fce3ef61f190a (patch)
tree609cdd91b4fc58caea80f69d0402bf516d07e2d3
parent4e0acbc7b67c5386a3a9ed60795f9cab672a3262 (diff)
downloadmongo-d31bf41e161177d933bcac782a3fce3ef61f190a.tar.gz
SERVER-18486 modernize MONGO_DISALLOW_COPYING
- explicitly delete copy constructor and copy assignment operator, rather than making them private
-rw-r--r--src/mongo/base/disallow_copying.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mongo/base/disallow_copying.h b/src/mongo/base/disallow_copying.h
index 2e774e4871b..9a3b68903ea 100644
--- a/src/mongo/base/disallow_copying.h
+++ b/src/mongo/base/disallow_copying.h
@@ -32,6 +32,9 @@
* for class "CLASS". Must be the _first_ or _last_ line of the class declaration. Prefer
* to use it as the first line.
*
+ * If you use this macro and wish to make the class movable, you must define the move assignment
+ * operator and move constructor.
+ *
* Usage:
* class Foo {
* MONGO_DISALLOW_COPYING(Foo);
@@ -39,7 +42,6 @@
* ...
* };
*/
-#define MONGO_DISALLOW_COPYING(CLASS) \
- private: \
- CLASS(const CLASS&); \
- CLASS& operator=(const CLASS&)
+#define MONGO_DISALLOW_COPYING(CLASS) \
+ CLASS(const CLASS&) = delete; \
+ CLASS& operator=(const CLASS&) = delete