Add DISALLOW_COPY_AND_ASSIGN macro.
Make the DISALLOW_COPY_AND_ASSIGN macro delete the member functions rather
than just not defining them to improve analysis of the Scoped.. classes.
Add a few missing const qualifiers.
Change-Id: I48eee0c22908d45a05df6979aa61442d2eedcf36
diff --git a/include/nativehelper/UniquePtr.h b/include/nativehelper/UniquePtr.h
index 50f75b2..7890d52 100644
--- a/include/nativehelper/UniquePtr.h
+++ b/include/nativehelper/UniquePtr.h
@@ -18,6 +18,7 @@
#define UNIQUE_PTR_H_included
#include <cstdlib> // For NULL.
+#include "JNIHelp.h" // For DISALLOW_COPY_AND_ASSIGN.
// This is a fake declaration of std::swap to avoid including <algorithm>
namespace std {
@@ -98,9 +99,7 @@
template <typename T2> bool operator==(const UniquePtr<T2>& p) const;
template <typename T2> bool operator!=(const UniquePtr<T2>& p) const;
- // Disallow copy and assignment.
- UniquePtr(const UniquePtr&);
- void operator=(const UniquePtr&);
+ DISALLOW_COPY_AND_ASSIGN(UniquePtr);
};
// Partial specialization for array types. Like std::unique_ptr, this removes
@@ -136,9 +135,7 @@
private:
T* mPtr;
- // Disallow copy and assignment.
- UniquePtr(const UniquePtr&);
- void operator=(const UniquePtr&);
+ DISALLOW_COPY_AND_ASSIGN(UniquePtr);
};
#if UNIQUE_PTR_TESTS