Reviewers: Sven Panne,
Description:
Use C++11 deleted functions feature if available.
Implement DISALLOW_COPY_AND_ASSIGN and DISALLOW_IMPLICIT_CONSTRUCTORS
using C++11 deleted functions if possible.
Please review this at https://codereview.chromium.org/19728003/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/globals.h
Index: src/globals.h
diff --git a/src/globals.h b/src/globals.h
index
f00e676dde9866b9eb7bb2005d80ed4766da46a2..91942d30cd84eed02bac059fb01d4840de9087fb
100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -327,11 +327,20 @@ F FUNCTION_CAST(Address addr) {
}
+#if __cplusplus >= 201103L || \
+ (defined(__has_feature) && __has_feature(cxx_deleted_functions)) || \
+ (defined(__has_extension) && __has_extension(cxx_deleted_functions))
+#define DISALLOW_BY_DELETE = delete
+#else
+#define DISALLOW_BY_DELETE
+#endif
+
+
// A macro to disallow the evil 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&)
+#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
+ TypeName(const TypeName&) DISALLOW_BY_DELETE; \
+ void operator=(const TypeName&) DISALLOW_BY_DELETE
// A macro to disallow all the implicit constructors, namely the
@@ -341,7 +350,7 @@ F FUNCTION_CAST(Address addr) {
// that wants to prevent anyone from instantiating it. This is
// especially useful for classes containing only static methods.
#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
- TypeName(); \
+ TypeName() DISALLOW_BY_DELETE; \
DISALLOW_COPY_AND_ASSIGN(TypeName)
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.