summaryrefslogtreecommitdiffstats
path: root/base/include/android-base/macros.h
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2016-08-29 09:36:31 -0700
committerAndreas Gampe <agampe@google.com>2016-08-29 09:36:31 -0700
commit247924a36fe5623be87017d42704fc1fd939010b (patch)
tree03bb71491da0f81762054a2cfaafede24ac8c6a3 /base/include/android-base/macros.h
parentbd7d2e2ec07ad94ab0aab940cf01adf70778804f (diff)
downloadsystem_core-247924a36fe5623be87017d42704fc1fd939010b.tar.gz
system_core-247924a36fe5623be87017d42704fc1fd939010b.tar.bz2
system_core-247924a36fe5623be87017d42704fc1fd939010b.zip
Libbase: add C++11 support to DISALLOW_IMPLICIT_CONSTRUCTORS
Use delete when possible. Test: m Test: m test-art-host Change-Id: Ib741564c7a31348b2f706fe55eb23d9886f865e3
Diffstat (limited to 'base/include/android-base/macros.h')
-rw-r--r--base/include/android-base/macros.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/base/include/android-base/macros.h b/base/include/android-base/macros.h
index 299ec35a9..ee16d023c 100644
--- a/base/include/android-base/macros.h
+++ b/base/include/android-base/macros.h
@@ -60,9 +60,18 @@
// 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.
+//
+// When building with C++11 toolchains, just use the language support
+// for explicitly deleted methods.
+#if __cplusplus >= 201103L
+#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
+ TypeName() = delete; \
+ DISALLOW_COPY_AND_ASSIGN(TypeName)
+#else
#define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
TypeName(); \
DISALLOW_COPY_AND_ASSIGN(TypeName)
+#endif
// The arraysize(arr) macro returns the # of elements in an array arr.
// The expression is a compile-time constant, and therefore can be