summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2014-10-22 04:33:01 +0200
committerBen Noordhuis <info@bnoordhuis.nl>2014-10-23 22:49:59 +0200
commitc038dcc360cb5e72c5891d1ef59640f5c3fa76b8 (patch)
tree349150545cc59d4fef1ba84f1a94943021f1fbde
parent9f5800ab81dd33da792477e5451ec4c83b1cc0fb (diff)
downloadnode-new-c038dcc360cb5e72c5891d1ef59640f5c3fa76b8.tar.gz
src: update DISALLOW_COPY_AND_ASSIGN() to c++11
Mark the matrix of copy/move constructor/assignment operator as deleted. Prevents the object from being copied around (the macro already did that pre-C++11), but also from being moved out.
-rw-r--r--src/node.cc3
-rw-r--r--src/node_file.cc4
-rw-r--r--src/util.h6
3 files changed, 6 insertions, 7 deletions
diff --git a/src/node.cc b/src/node.cc
index eaf2277579..6aaf306827 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -165,8 +165,7 @@ class ArrayBufferAllocator : public ArrayBuffer::Allocator {
virtual void Free(void* data, size_t length) override;
private:
ArrayBufferAllocator() {}
- ArrayBufferAllocator(const ArrayBufferAllocator&);
- void operator=(const ArrayBufferAllocator&);
+ DISALLOW_COPY_AND_ASSIGN(ArrayBufferAllocator);
};
ArrayBufferAllocator ArrayBufferAllocator::the_singleton;
diff --git a/src/node_file.cc b/src/node_file.cc
index 86474b75fa..dec90b5291 100644
--- a/src/node_file.cc
+++ b/src/node_file.cc
@@ -248,10 +248,8 @@ static void After(uv_fs_t *req) {
struct fs_req_wrap {
fs_req_wrap() {}
~fs_req_wrap() { uv_fs_req_cleanup(&req); }
- // Ensure that copy ctor and assignment operator are not used.
- fs_req_wrap(const fs_req_wrap& req);
- fs_req_wrap& operator=(const fs_req_wrap& req);
uv_fs_t req;
+ DISALLOW_COPY_AND_ASSIGN(fs_req_wrap);
};
diff --git a/src/util.h b/src/util.h
index 4f0de82d56..7bafe79e30 100644
--- a/src/util.h
+++ b/src/util.h
@@ -34,8 +34,10 @@ namespace node {
(node::OneByteString((isolate), (string), sizeof(string) - 1))
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
- void operator=(const TypeName&); \
- TypeName(const TypeName&)
+ void operator=(const TypeName&) = delete; \
+ void operator=(TypeName&&) = delete; \
+ TypeName(const TypeName&) = delete; \
+ TypeName(TypeName&&) = delete
#if defined(NDEBUG)
# define ASSERT(expression)