Templatize wxScopedPtr

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51070 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2008-01-07 12:09:22 +00:00
parent a6acecec40
commit 89969a9128
5 changed files with 149 additions and 9 deletions

View File

@@ -382,8 +382,9 @@ wxWidgets provides a few smart pointer class templates.
\twocolwidtha{6cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{\helpref{wxWeakRef<T>}{wxweakref}}{A weak reference}
\twocolitem{\helpref{wxObjectDataPtr<T>}{wxobjectdataptr}}{A shared pointer using intrusive reference counting}
\twocolitem{\helpref{wxScopedPtr<T>}{wxscopedptrtemplate}}{A scoped pointer}
\twocolitem{\helpref{wxWeakRef<T>}{wxweakref}}{A weak reference}
\end{twocollist}
{\large {\bf Run-time class information system}}

View File

@@ -358,6 +358,7 @@
\input sashwin.tex
\input scpdarry.tex
\input scpdptr.tex
\input scopedptr.tex
\input screendc.tex
\input scrolbar.tex
\input scrolwin.tex

View File

@@ -4,6 +4,9 @@ This is a simple scoped smart pointer implementation that is similar to
the \urlref{Boost}{http://www.boost.org/} smart pointers but rewritten to
use macros instead.
Since wxWidgets 2.9.0 there is also a templated version of this class
with the same name. See \helpref{wxScopedPtr<T>}{wxscopedptrtemplate}.
A smart pointer holds a pointer to an object. The memory used by the object is
deleted when the smart pointer goes out of scope. This class is different from
the \texttt{std::auto\_ptr<>} in so far as it doesn't provide copy constructor

View File

@@ -0,0 +1,71 @@
\section{\class{wxSharedPtr<T>}}\label{wxsharedptr}
A smart pointer with non-intrusive reference counting.
\wxheading{Derived from}
No base class
\wxheading{Include files}
<ptr\_shrd.h>
\wxheading{Data structures}
{\small \begin{verbatim}
typedef T element\_type
\end{verbatim}}
\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*}\label{wxsharedptroperatorptrt}
\constfunc{T\&}{operator*}{\void}
Returns pointer to its object or NULL.
\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.
\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.