| Version: 3.2.5

Public Member Functions | List of all members
wxScopedTiedPtr Class Reference
Class List by Category » Smart Pointers

`#include <wx/scopedptr.h>`

Inheritance diagram for wxScopedTiedPtr:
[legend]

## 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. More...
| ~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. More...
Public Member Functions inherited from wxScopedPtr
| wxScopedPtr (type *T=NULL)
| Creates the smart pointer with the given pointer or none if NULL. More...
| ~wxScopedPtr ()
| Destructor frees the pointer help by this object if it is not NULL. More...
T * | get () const
| This operator gets the pointer stored in the smart pointer or returns NULL if there is none. More...
T & | operator* () const
| This operator works like the standard C++ pointer operator to return the object being pointed to by the pointer. More...
T * | operator-> () const
| Smart pointer member access. More...
T * | release ()
| Returns the currently hold pointer and resets the smart pointer object to NULL. More...
| reset (T *p=NULL)
| Deletes the currently held pointer and sets it to p or to NULL if no arguments are specified. More...
| swap (wxScopedPtr &other)
| Swap the pointer inside the smart pointer with other. More...

## Constructor & Destructor Documentation

## ◆ wxScopedTiedPtr()

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::~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!