wxscopedtiedptrthis 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. example derives from include files <wx/ptr_scpd.h> members
wxscopedtiedptr::wxscopedtiedptr
wxscopedtiedptr::wxscopedtiedptrwxscopedtiedptr(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~wxscopedtiedptr() destructor frees the pointer help by this object and restores the value stored at the tied location (as specified in the constructor) to the old value. warning: this location may now contain an uninitialized value if it hadn't been initialized previously, in particular don't count on it magically being null!
|