\section{\class{wxSharedPtr<T>}}\label{wxsharedptr}

A smart pointer with non-intrusive reference counting. It is modeled
after {\bf boost::shared\_ptr<>} and can be used with STL containers 
and \helpref{wxVector<>}{wxvector} - unlike {\bf std::auto\_ptr<>}
and \helpref{wxScopedPtr<>}{wxscopedptrtemplate}.

\wxheading{Derived from}

No base class

\wxheading{Include files}

<ptr\_shrd.h>

\wxheading{Data structures}

{\small% 
\begin{verbatim}
typedef T element_type
\end{verbatim}
}%

\wxheading{See also}

\helpref{wxScopedPtr}{wxscopedptrtemplate}, \helpref{wxWeakRef}{wxweakref},
\helpref{wxObjectDataPtr}{wxobjectdataptr}


\latexignore{\rtfignore{\wxheading{Members}}}


\membersection{wxSharedPtr<T>::wxSharedPtr<T>}\label{wxsharedptrwxsharedptr}

\func{wxEXPLICIT}{wxSharedPtr<T>}{\param{T* }{ptr = NULL}}

\func{}{wxSharedPtr<T>}{\param{const wxSharedPtr<T>\& }{tocopy}}

Constructors.

\membersection{wxSharedPtr<T>::\destruct{wxSharedPtr<T>}}\label{wxsharedptrdtor}

\func{}{\destruct{wxSharedPtr<T>}}{\void}

Destructor.

\membersection{wxSharedPtr<T>::get}\label{wxsharedptrget}

\constfunc{T*}{get}{\void}

Returns pointer to its object or NULL.

\membersection{wxSharedPtr<T>::operator unspecified\_bool\_type}\label{wxsharedptroperatorbool}

\constfunc{}{operator unspecified\_bool\_type}{\void}

Conversion to a boolean expression (in a variant which is not 
convertable to anything but a boolean expression). If this class
contains a valid pointer it will return {\it true}, if it contains
a NULL pointer it will return {\it false}.

\membersection{wxSharedPtr<T>::operator*}\label{wxsharedptroperatorreft}

\constfunc{T\&}{operator*}{\void}

Returns a reference to the object. If the internal pointer is NULL this
method will cause an assert in debug mode.

\membersection{wxSharedPtr<T>::operator->}\label{wxsharedptroperatorderef}

\constfunc{T*}{operator->}{\void}

Returns pointer to its object or NULL.

\membersection{wxSharedPtr<T>::operator=}\label{wxsharedptroperatorassign}

\func{wxSharedPtr<T>\& operator}{operator=}{\param{const wxSharedPtr<T>\& }{tocopy}}

Assignment operator. Releases any previously held pointer
and creates a reference to the same object as {\it topcopy}.

\membersection{wxSharedPtr<T>::operator=}\label{wxsharedptroperatorassign2}

\func{wxSharedPtr<T>\& operator}{operator=}{\param{T *}{ptr}}

Assignment operator. Releases any previously held pointer
and creates a reference to {\it ptr}.

\membersection{wxSharedPtr<T>::unique}\label{wxsharedptrunique}

\constfunc{bool}{unique}{\void}

Returns true if this is the only pointer pointing to its object.

\membersection{wxSharedPtr<T>::use\_count}\label{wxsharedptruse\_count}

\constfunc{long}{use\_count}{\void}

Returns the number of pointers pointing to its object.

\membersection{wxSharedPtr<T>::reset}\label{wxsharedptrreset}

\func{void}{reset}{\param{T * }{ptr = NULL}}

Reset pointer to {\it ptr}. If the reference count of the
previously owned pointer was 1 it will be deleted.

