32 #ifndef __HACKED_AUTO_PTR__ 33 #define __HACKED_AUTO_PTR__ 39 struct hacked_auto_ptr_ref
50 typedef _Tp element_type;
52 explicit hacked_auto_ptr(_Tp* p = 0) throw() : ptr_(p) {}
53 hacked_auto_ptr(hacked_auto_ptr& p)
throw() : ptr_(p.release()) {}
54 template<
class _Up> hacked_auto_ptr(hacked_auto_ptr<_Up>& p)
throw()
55 : ptr_(p.release()) {}
56 hacked_auto_ptr& operator=(hacked_auto_ptr& p)
throw()
57 {reset(p.release());
return *
this;}
58 template<
class _Up> hacked_auto_ptr& operator=(hacked_auto_ptr<_Up>& p)
throw()
59 {reset(p.release());
return *
this;}
60 hacked_auto_ptr& operator=(hacked_auto_ptr_ref<_Tp> p)
throw()
61 {reset(p.ptr_);
return *
this;}
62 ~hacked_auto_ptr() throw() {
delete ptr_;}
64 _Tp& operator*()
const throw()
66 _Tp* operator->()
const throw() {
return ptr_;}
67 _Tp*
get()
const throw() {
return ptr_;}
68 _Tp* release() throw()
74 void reset(_Tp* p = 0) throw()
81 hacked_auto_ptr(hacked_auto_ptr_ref<_Tp> p)
throw() : ptr_(p.ptr_) {}
82 template<
class _Up>
operator hacked_auto_ptr_ref<_Up>()
throw()
83 {hacked_auto_ptr_ref<_Up> t; t.ptr_ = release();
return t;}
84 template<
class _Up>
operator hacked_auto_ptr<_Up>()
throw()
85 {
return hacked_auto_ptr<_Up>(release());}
89 class hacked_auto_ptr<void>
92 typedef void element_type;
99 #endif // __HACKED_AUTO_PTR__