#include </home/zeitlin/src/wx/github/interface/wx/scopedptr.h>
This is a variation on the topic of wxScopedPtr.
This class is also a smart pointer but in addition it "ties" the pointer value to another variable. In other words, during the life time of this class the value of that variable is set to be the same as the value of the pointer itself and it is reset to its old value when the object is destroyed. This class is especially useful when converting the existing code (which may already store the pointers value in some variable) to the smart pointers.
Public Member Functions | |
wxScopedTiedPtr (T **ppTie, T *ptr) | |
Constructor creates a smart pointer initialized with ptr and stores ptr in the location specified by ppTie which must not be NULL. | |
~wxScopedTiedPtr () | |
Destructor frees the pointer help by this object and restores the value stored at the tied location (as specified in the wxScopedTiedPtr() constructor) to the old value. |
wxScopedTiedPtr::wxScopedTiedPtr | ( | T ** | ppTie, |
T * | ptr | ||
) |
Constructor creates a smart pointer initialized with ptr and stores ptr in the location specified by ppTie which must not be NULL.
wxScopedTiedPtr::~wxScopedTiedPtr | ( | ) |
Destructor frees the pointer help by this object and restores the value stored at the tied location (as specified in the wxScopedTiedPtr() constructor) to the old value.