Add basic deleter support to wxSharedPtr<T>.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74773 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2013-09-06 17:09:11 +00:00
parent 36c5850bcf
commit 4852df90e2
2 changed files with 64 additions and 3 deletions

View File

@@ -28,6 +28,22 @@ public:
*/
wxEXPLICIT wxSharedPtr(T* ptr = NULL);
/**
Constructor.
Creates shared pointer from the raw pointer @a ptr and deleter @a d
and takes ownership of it.
@param ptr The raw pointer.
@param d Deleter - a functor that is called instead of delete to
free the @a ptr raw pointer when its reference count drops to
zero.
@since 3.0
*/
template<typename Deleter>
wxEXPLICIT wxSharedPtr(T* ptr, Deleter d);
/**
Copy constructor.
*/
@@ -88,6 +104,21 @@ public:
*/
void reset(T* ptr = NULL);
/**
Reset pointer to @a ptr.
If the reference count of the previously owned pointer was 1 it will be deleted.
@param ptr The new raw pointer.
@param d Deleter - a functor that is called instead of delete to
free the @a ptr raw pointer when its reference count drops to
zero.
@since 3.0
*/
template<typename Deleter>
void reset(T* ptr, Deleter d);
/**
Returns @true if this is the only pointer pointing to its object.
*/