X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/37494cb3360d119f0da8314463ece1a6144f8de6..92c0fc34c104c8d7c12d6a3b78ea232690fc23f4:/interface/wx/sharedptr.h diff --git a/interface/wx/sharedptr.h b/interface/wx/sharedptr.h index 47b73c0d60..8b7087baed 100644 --- a/interface/wx/sharedptr.h +++ b/interface/wx/sharedptr.h @@ -2,14 +2,13 @@ // Name: sharedptr.h // Purpose: interface of wxSharedPtr // Author: wxWidgets team -// RCS-ID: $Id$ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// /** A smart pointer with non-intrusive reference counting. - It is modeled after @c boost::shared_ptr<> and can be used with STL + It is modelled after @c boost::shared_ptr<> and can be used with STL containers and wxVector unlike @c std::auto_ptr<> and wxScopedPtr. @library{wxbase} @@ -29,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 + wxEXPLICIT wxSharedPtr(T* ptr, Deleter d); + /** Copy constructor. */ @@ -89,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 + void reset(T* ptr, Deleter d); + /** Returns @true if this is the only pointer pointing to its object. */