From a7d289ce1a4a04af3521ba9720856c0a5282fddc Mon Sep 17 00:00:00 2001 From: mental Date: Thu, 15 May 2008 17:01:23 +0000 Subject: [PATCH] add DumbPtr --- src/lifecycle.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/lifecycle.h b/src/lifecycle.h index 7e37bd852..e86697c74 100644 --- a/src/lifecycle.h +++ b/src/lifecycle.h @@ -89,6 +89,30 @@ private: } }; +// Wrapper for a simple pointer emulating the ManagedPtr interface +template +class DumbPtr { +public: + DumbPtr() : ptr(NULL) {} + DumbPtr(T *p) : ptr(p) {} + DumbPtr(DumbPtr const &other) : ptr(other.ptr) {} + + operator T *() const { return ptr; } + T &operator*() const { return *ptr; } + T *operator->() const { return ptr; } + DumbPtr &operator=(T *p) { + ptr = p; + return *this; + } + DumbPtr &operator=(DumbPtr const &other) { + ptr = other.ptr; + return *this; + } + +private: + T *ptr; +}; + // Dummy implementation of AbstractManaged to ease migration class DummyManaged : public virtual AbstractManaged { protected: -- 2.30.2