Version: 2.9.4
Public Member Functions
wxScopedTiedPtr Class Reference

#include </home/zeitlin/src/wx/github/interface/wx/scopedptr.h>

Inheritance diagram for wxScopedTiedPtr:

Detailed Description

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.

Library:  wxBase
Category:  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.

List of all members.


Constructor & Destructor Documentation

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.

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!
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines