#include <wx/scopedptr.h>
A scoped pointer template class.
It is the template version of the old-style scoped pointer macros.
Notice that objects of this class intentionally cannot be copied.
Public Member Functions | |
wxScopedPtr (T *ptr=NULL) | |
Constructor takes ownership of the pointer. More... | |
~wxScopedPtr () | |
Destructor deletes the pointer. More... | |
T * | get () const |
Returns pointer to object or NULL. More... | |
operator unspecified_bool_type () const | |
Conversion to a boolean expression (in a variant which is not convertible to anything but a boolean expression). More... | |
T & | operator* () const |
Returns a reference to the object. More... | |
T * | operator-> () const |
Smart pointer member access. More... | |
T * | release () |
Releases the current pointer and returns it. More... | |
void | reset (T *ptr=NULL) |
Reset pointer to the value of ptr. More... | |
void | swap (wxScopedPtr< T > &ot) |
Swaps pointers. More... | |
wxScopedPtr< T >::wxScopedPtr | ( | T * | ptr = NULL | ) |
Constructor takes ownership of the pointer.
ptr | Pointer allocated with new or NULL. |
wxScopedPtr< T >::~wxScopedPtr | ( | ) |
Destructor deletes the pointer.
T* wxScopedPtr< T >::get | ( | ) | const |
Returns pointer to object or NULL.
wxScopedPtr< 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& wxScopedPtr< 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* wxScopedPtr< T >::operator-> | ( | ) | const |
Smart pointer member access.
Returns pointer to object.
If the internal pointer is NULL this method will cause an assert in debug mode.
T* wxScopedPtr< T >::release | ( | ) |
Releases the current pointer and returns it.
void wxScopedPtr< T >::reset | ( | T * | ptr = NULL | ) |
Reset pointer to the value of ptr.
The previous pointer will be deleted.
void wxScopedPtr< T >::swap | ( | wxScopedPtr< T > & | ot | ) |
Swaps pointers.