]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/sharedptr.tex
no changes, just come cleanup and more comments
[wxWidgets.git] / docs / latex / wx / sharedptr.tex
CommitLineData
89969a91
RR
1\section{\class{wxSharedPtr<T>}}\label{wxsharedptr}
2
72636c15
RR
3A smart pointer with non-intrusive reference counting. It is modeled
4after {\bf boost::shared\_ptr<>} and can be used with STL containers
5and \helpref{wxVector<>}{wxvector} - unlike {\bf std::auto\_ptr<>}
6and \helpref{wxScopedPtr<>}{wxscopedptrtemplate}.
89969a91
RR
7
8\wxheading{Derived from}
9
10No base class
11
12\wxheading{Include files}
13
14<ptr\_shrd.h>
15
16\wxheading{Data structures}
17
0155f164
RR
18{\small%
19\begin{verbatim}
20typedef T element_type
21\end{verbatim}
22}%
89969a91 23
72636c15
RR
24\wxheading{See also}
25
aaf4caee
RR
26\helpref{wxScopedPtr}{wxscopedptrtemplate}, \helpref{wxWeakRef}{wxweakref},
27\helpref{wxObjectDataPtr}{wxobjectdataptr}
72636c15
RR
28
29
89969a91
RR
30\latexignore{\rtfignore{\wxheading{Members}}}
31
32
33\membersection{wxSharedPtr<T>::wxSharedPtr<T>}\label{wxsharedptrwxsharedptr}
34
35\func{wxEXPLICIT}{wxSharedPtr<T>}{\param{T* }{ptr = NULL}}
36
37\func{}{wxSharedPtr<T>}{\param{const wxSharedPtr<T>\& }{tocopy}}
38
39Constructors.
40
41\membersection{wxSharedPtr<T>::\destruct{wxSharedPtr<T>}}\label{wxsharedptrdtor}
42
43\func{}{\destruct{wxSharedPtr<T>}}{\void}
44
45Destructor.
46
47\membersection{wxSharedPtr<T>::get}\label{wxsharedptrget}
48
49\constfunc{T*}{get}{\void}
50
51Returns pointer to its object or NULL.
52
a60b0ddc
RR
53\membersection{wxSharedPtr<T>::operator unspecified\_bool\_type}\label{wxsharedptroperatorbool}
54
55\constfunc{}{operator unspecified\_bool\_type}{\void}
56
57Conversion to a boolean expression (in a variant which is not
58convertable to anything but a boolean expression). If this class
59contains a valid pointer it will return {\it true}, if it contains
60a NULL pointer it will return {\it false}.
61
9dd5ff5b 62\membersection{wxSharedPtr<T>::operator*}\label{wxsharedptroperatorreft}
89969a91
RR
63
64\constfunc{T\&}{operator*}{\void}
65
9dd5ff5b
RR
66Returns a reference to the object. If the internal pointer is NULL this
67method will cause an assert in debug mode.
89969a91
RR
68
69\membersection{wxSharedPtr<T>::operator->}\label{wxsharedptroperatorderef}
70
71\constfunc{T*}{operator->}{\void}
72
73Returns pointer to its object or NULL.
74
75\membersection{wxSharedPtr<T>::operator=}\label{wxsharedptroperatorassign}
76
77\func{wxSharedPtr<T>\& operator}{operator=}{\param{const wxSharedPtr<T>\& }{tocopy}}
78
72636c15 79Assignment operator. Releases any previously held pointer
aaf4caee 80and creates a reference to the same object as {\it topcopy}.
72636c15
RR
81
82\membersection{wxSharedPtr<T>::operator=}\label{wxsharedptroperatorassign2}
83
84\func{wxSharedPtr<T>\& operator}{operator=}{\param{T *}{ptr}}
85
86Assignment operator. Releases any previously held pointer
87and creates a reference to {\it ptr}.
89969a91
RR
88
89\membersection{wxSharedPtr<T>::unique}\label{wxsharedptrunique}
90
91\constfunc{bool}{unique}{\void}
92
93Returns true if this is the only pointer pointing to its object.
94
95\membersection{wxSharedPtr<T>::use\_count}\label{wxsharedptruse\_count}
96
97\constfunc{long}{use\_count}{\void}
98
99Returns the number of pointers pointing to its object.
100
9dd5ff5b
RR
101\membersection{wxSharedPtr<T>::reset}\label{wxsharedptrreset}
102
103\func{void}{reset}{\param{T * }{ptr = NULL}}
104
aaf4caee
RR
105Reset pointer to {\it ptr}. If the reference count of the
106previously owned pointer was 1 it will be deleted.
9dd5ff5b 107