Add reset(pointer,deleter_type) member function to UniquePtr.

This commit is contained in:
David Capello 2011-03-20 17:58:19 -03:00
parent 775357d04f
commit 42dbe7d026

View File

@ -59,9 +59,19 @@ public:
{ {
if (m_ptr) if (m_ptr)
m_deleter(m_ptr); m_deleter(m_ptr);
m_ptr = ptr; m_ptr = ptr;
} }
void reset(pointer ptr, deleter_type deleter)
{
if (m_ptr)
m_deleter(m_ptr);
m_ptr = ptr;
m_deleter = deleter;
}
pointer release() pointer release()
{ {
pointer ptr(m_ptr); pointer ptr(m_ptr);