From f2902217b38cf2e16e851ae84d61247f8e828180 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Mon, 25 Mar 2019 17:53:14 +0100 Subject: Update the 7z installer stub source to 18.05. Tag #1022 --- other-licenses/7zstub/src/CPP/Common/AutoPtr.h | 35 ++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 other-licenses/7zstub/src/CPP/Common/AutoPtr.h (limited to 'other-licenses/7zstub/src/CPP/Common/AutoPtr.h') diff --git a/other-licenses/7zstub/src/CPP/Common/AutoPtr.h b/other-licenses/7zstub/src/CPP/Common/AutoPtr.h new file mode 100644 index 000000000..e53fb7f5d --- /dev/null +++ b/other-licenses/7zstub/src/CPP/Common/AutoPtr.h @@ -0,0 +1,35 @@ +// Common/AutoPtr.h + +#ifndef __COMMON_AUTOPTR_H +#define __COMMON_AUTOPTR_H + +template class CMyAutoPtr +{ + T *_p; +public: + CMyAutoPtr(T *p = 0) : _p(p) {} + CMyAutoPtr(CMyAutoPtr& p): _p(p.release()) {} + CMyAutoPtr& operator=(CMyAutoPtr& p) + { + reset(p.release()); + return (*this); + } + ~CMyAutoPtr() { delete _p; } + T& operator*() const { return *_p; } + // T* operator->() const { return (&**this); } + T* get() const { return _p; } + T* release() + { + T *tmp = _p; + _p = 0; + return tmp; + } + void reset(T* p = 0) + { + if (p != _p) + delete _p; + _p = p; + } +}; + +#endif -- cgit v1.2.3