From 42dbe7d026bbb31e9cdc1d02274b0570b241b4b6 Mon Sep 17 00:00:00 2001 From: David Capello Date: Sun, 20 Mar 2011 17:58:19 -0300 Subject: [PATCH] Add reset(pointer,deleter_type) member function to UniquePtr. --- src/base/unique_ptr.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/base/unique_ptr.h b/src/base/unique_ptr.h index 48ea7dfd2..62dc4ea21 100644 --- a/src/base/unique_ptr.h +++ b/src/base/unique_ptr.h @@ -59,9 +59,19 @@ public: { if (m_ptr) m_deleter(m_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 ptr(m_ptr);