Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(422)

Unified Diff: base/macros.h

Issue 1222403002: Use "= delete" for DISALLOW_COPY_AND_ASSIGN on Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/snappy/linux/snappy-stubs-public.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/macros.h
diff --git a/base/macros.h b/base/macros.h
index fa12dd2e6bca88aa06a2e425dc3a66ab83e48207..f20284f48ed3382b2f58b09d6c00370bc2cf249f 100644
--- a/base/macros.h
+++ b/base/macros.h
@@ -21,18 +21,21 @@
#define DISALLOW_ASSIGN(TypeName) \
void operator=(const TypeName&) = delete
+#if defined(OS_LINUX)
+// A macro to disallow the copy constructor and operator= functions.
+#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
+ TypeName(const TypeName&) = delete; \
+ void operator=(const TypeName&) = delete
+#else
// A macro to disallow the copy constructor and operator= functions
// This should be used in the private: declarations for a class
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&); \
void operator=(const TypeName&)
+#endif
// A macro to disallow all the implicit constructors, namely the
// default constructor, copy constructor and operator= functions.
-//
-// This should be used in the private: declarations for a class
-// that wants to prevent anyone from instantiating it. This is
-// especially useful for classes containing only static methods.
#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
TypeName() = delete; \
DISALLOW_COPY_AND_ASSIGN(TypeName)
« no previous file with comments | « no previous file | third_party/snappy/linux/snappy-stubs-public.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698