1 #ifndef DOZERG_SCOPED_POINTER_H_20130603 2 #define DOZERG_SCOPED_POINTER_H_20130603 5 #include "tools/memory.hh" 9 template<
class T,
class Alloc = std::allocator<T> >
13 typedef void (__Myt::*__SafeBool)(__Myt &);
15 typedef T element_type;
16 typedef Alloc allocator_type;
18 typedef T & reference;
21 ~
CScopedPtr(){tools::Delete(p_, allocator_type());}
22 bool operator !()
const throw(){
return (NULL == p_);}
23 operator __SafeBool()
const throw(){
return (
operator !() ? NULL : &__Myt::swap);}
24 pointer
get()
const throw(){
return p_;}
25 pointer operator ->()
const throw(){
return get();}
26 reference operator *()
const throw(){
return *
get();}
27 void reset(pointer p = NULL)
throw(){
31 pointer release()
throw(){
36 void swap(__Myt & a)
throw(){std::swap(p_, a.p_);}
39 __Myt & operator =(
const __Myt &);
44 template<
class T,
class Alloc>
Definition: scoped_ptr.hh:10