Lines Matching defs:UniquePtr
19 * THIS IS A COPY OF libcore/include/UniquePtr.h AND AS SUCH THAT IS THE
56 // UniquePtr<C> c(new C);
58 class UniquePtr {
60 // Construct a new UniquePtr, taking ownership of the given raw pointer.
61 explicit UniquePtr(T* ptr = NULL) : mPtr(ptr) {
64 ~UniquePtr() {
74 // The pointer will not be deleted by UniquePtr.
96 template <typename T2> bool operator==(const UniquePtr<T2>& p) const;
97 template <typename T2> bool operator!=(const UniquePtr<T2>& p) const;
100 UniquePtr(const UniquePtr&);
101 void operator=(const UniquePtr&);
107 class UniquePtr<T[], D> {
109 explicit UniquePtr(T* ptr = NULL) : mPtr(ptr) {
112 ~UniquePtr() {
138 UniquePtr(const UniquePtr&);
139 void operator=(const UniquePtr&);
145 // g++ -g -DUNIQUE_PTR_TESTS -x c++ UniquePtr.h && ./a.out
172 // UniquePtr<T> tests...
177 UniquePtr<C> c(new C);
184 UniquePtr<C> c(new C);
192 UniquePtr<C> c(new C);
200 // UniquePtr<T[]> tests...
205 UniquePtr<C[]> cs(new C[4]);
211 UniquePtr<C[]> c(new C[4]);
219 UniquePtr<C[]> c(new C[4]);
231 UniquePtr<int, Freer> i(reinterpret_cast<int*>(malloc(sizeof(int))));