SmartPtr: add reset()
This mimics the behavior of boost smart pointers and is useful for code where variables can be of either type, because "= NULL" is not supported by our boost::intrusive_ptr wrapper.
This commit is contained in:
parent
0c5ba9355f
commit
fb83c468a8
|
@ -148,6 +148,10 @@ class SmartPtr
|
|||
m_pointer = pointer;
|
||||
}
|
||||
|
||||
void reset( T pointer = NULL ) {
|
||||
set(pointer, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* transfer ownership over the pointer to caller and stop tracking it:
|
||||
* pointer tracked by smart pointer is set to NULL and the original
|
||||
|
@ -178,6 +182,10 @@ template<class T, class base = T, class R = Unref > class eptr :
|
|||
base_t::set(pointer);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void reset(T *pointer = NULL) {
|
||||
base_t::set(pointer);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T> class CxxUnref {
|
||||
|
|
Loading…
Reference in New Issue