#include </home/zeitlin/src/wx/github/interface/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. | |
~wxScopedPtr () | |
Destructor deletes the pointer. | |
T * | get () const |
Returns pointer to 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. | |
T * | release () |
Releases the current pointer and returns it. | |
void | reset (T *ptr=NULL) |
Reset pointer to the value of ptr. | |
void | swap (wxScopedPtr< T > &ot) |
Swaps pointers. |
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.