#include <wx/sharedptr.h>
Inheritance diagram for wxSharedPtr< T >:A smart pointer with non-intrusive reference counting.
It is modelled after boost::shared_ptr<> and can be used with STL containers and wxVector<T> unlike std::auto_ptr<> and wxScopedPtr<T>.
Public Member Functions | |
| wxEXPLICIT | wxSharedPtr (T *ptr=NULL) |
| Constructor. | |
| template<typename Deleter > | |
| wxEXPLICIT | wxSharedPtr (T *ptr, Deleter d) |
| Constructor. | |
| wxSharedPtr (const wxSharedPtr< T > &tocopy) | |
| Copy constructor. | |
| ~wxSharedPtr () | |
| Destructor. | |
| T * | get () const |
| Returns pointer to its object or NULL. | |
| operator unspecified_bool_type () const | |
| Conversion to a boolean expression (in a variant which is not convertible to anything but a boolean expression). | |
| T | operator* () const |
| Returns a reference to the object. | |
| T * | operator-> () const |
| Smart pointer member access. | |
| wxSharedPtr< T > & | operator= (T *ptr) |
| Assignment operator. | |
| wxSharedPtr< T > & | operator= (const wxSharedPtr< T > &tocopy) |
| Assignment operator. | |
| void | reset (T *ptr=NULL) |
| Reset pointer to ptr. | |
| template<typename Deleter > | |
| void | reset (T *ptr, Deleter d) |
| Reset pointer to ptr. | |
| bool | unique () const |
| Returns true if this is the only pointer pointing to its object. | |
| long | use_count () const |
| Returns the number of pointers pointing to its object. | |
| wxEXPLICIT wxSharedPtr< T >::wxSharedPtr | ( | T * | ptr = NULL | ) |
Constructor.
Creates shared pointer from the raw pointer ptr and takes ownership of it.
| wxEXPLICIT wxSharedPtr< T >::wxSharedPtr | ( | T * | ptr, |
| Deleter | d | ||
| ) |
Constructor.
Creates shared pointer from the raw pointer ptr and deleter d and takes ownership of it.
| ptr | The raw pointer. |
| d | Deleter - a functor that is called instead of delete to free the ptr raw pointer when its reference count drops to zero. |
| wxSharedPtr< T >::wxSharedPtr | ( | const wxSharedPtr< T > & | tocopy | ) |
Copy constructor.
| wxSharedPtr< T >::~wxSharedPtr | ( | ) |
Destructor.
| T* wxSharedPtr< T >::get | ( | ) | const |
Returns pointer to its object or NULL.
| wxSharedPtr< T >::operator unspecified_bool_type | ( | ) | const |
Conversion to a boolean expression (in a variant which is not convertible to anything but a boolean expression).
If this class contains a valid pointer it will return true, if it contains a NULL pointer it will return false.
| T wxSharedPtr< T >::operator* | ( | ) | const |
Returns a reference to the object.
If the internal pointer is NULL this method will cause an assert in debug mode.
| T* wxSharedPtr< T >::operator-> | ( | ) | const |
Smart pointer member access.
Returns pointer to its object.
If the internal pointer is NULL this method will cause an assert in debug mode.
| wxSharedPtr<T>& wxSharedPtr< T >::operator= | ( | T * | ptr | ) |
Assignment operator.
Releases any previously held pointer and creates a reference to ptr.
| wxSharedPtr<T>& wxSharedPtr< T >::operator= | ( | const wxSharedPtr< T > & | tocopy | ) |
Assignment operator.
Releases any previously held pointer and creates a reference to the same object as topcopy.
| void wxSharedPtr< T >::reset | ( | T * | ptr = NULL | ) |
Reset pointer to ptr.
If the reference count of the previously owned pointer was 1 it will be deleted.
| void wxSharedPtr< T >::reset | ( | T * | ptr, |
| Deleter | d | ||
| ) |
Reset pointer to ptr.
If the reference count of the previously owned pointer was 1 it will be deleted.
| ptr | The new raw pointer. |
| d | Deleter - a functor that is called instead of delete to free the ptr raw pointer when its reference count drops to zero. |
| bool wxSharedPtr< T >::unique | ( | ) | const |
Returns true if this is the only pointer pointing to its object.
| long wxSharedPtr< T >::use_count | ( | ) | const |
Returns the number of pointers pointing to its object.