]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/sharedptr.tex
docs
[wxWidgets.git] / docs / latex / wx / sharedptr.tex
1 \section{\class{wxSharedPtr<T>}}\label{wxsharedptr}
2
3 A smart pointer with non-intrusive reference counting. It is modeled
4 after {\bf boost::shared\_ptr<>} and can be used with STL containers
5 and \helpref{wxVector<>}{wxvector} - unlike {\bf std::auto\_ptr<>}
6 and \helpref{wxScopedPtr<>}{wxscopedptrtemplate}.
7
8 \wxheading{Derived from}
9
10 No base class
11
12 \wxheading{Include files}
13
14 <ptr\_shrd.h>
15
16 \wxheading{Data structures}
17
18 {\small%
19 \begin{verbatim}
20 typedef T element_type
21 \end{verbatim}
22 }%
23
24 \wxheading{See also}
25
26 \helpref{wxScopedPtr}{wxscopedptrtemplate}, \helpref{wxWeakRef}{wxweakref}
27
28
29 \latexignore{\rtfignore{\wxheading{Members}}}
30
31
32 \membersection{wxSharedPtr<T>::wxSharedPtr<T>}\label{wxsharedptrwxsharedptr}
33
34 \func{wxEXPLICIT}{wxSharedPtr<T>}{\param{T* }{ptr = NULL}}
35
36 \func{}{wxSharedPtr<T>}{\param{const wxSharedPtr<T>\& }{tocopy}}
37
38 Constructors.
39
40 \membersection{wxSharedPtr<T>::\destruct{wxSharedPtr<T>}}\label{wxsharedptrdtor}
41
42 \func{}{\destruct{wxSharedPtr<T>}}{\void}
43
44 Destructor.
45
46 \membersection{wxSharedPtr<T>::get}\label{wxsharedptrget}
47
48 \constfunc{T*}{get}{\void}
49
50 Returns pointer to its object or NULL.
51
52 \membersection{wxSharedPtr<T>::operator*}\label{wxsharedptroperatorreft}
53
54 \constfunc{T\&}{operator*}{\void}
55
56 Returns a reference to the object. If the internal pointer is NULL this
57 method will cause an assert in debug mode.
58
59 \membersection{wxSharedPtr<T>::operator->}\label{wxsharedptroperatorderef}
60
61 \constfunc{T*}{operator->}{\void}
62
63 Returns pointer to its object or NULL.
64
65 \membersection{wxSharedPtr<T>::operator=}\label{wxsharedptroperatorassign}
66
67 \func{wxSharedPtr<T>\& operator}{operator=}{\param{const wxSharedPtr<T>\& }{tocopy}}
68
69 Assignment operator. Releases any previously held pointer
70 and creates a reference to same object as {\it topcopy}.
71
72 \membersection{wxSharedPtr<T>::operator=}\label{wxsharedptroperatorassign2}
73
74 \func{wxSharedPtr<T>\& operator}{operator=}{\param{T *}{ptr}}
75
76 Assignment operator. Releases any previously held pointer
77 and creates a reference to {\it ptr}.
78
79 \membersection{wxSharedPtr<T>::unique}\label{wxsharedptrunique}
80
81 \constfunc{bool}{unique}{\void}
82
83 Returns true if this is the only pointer pointing to its object.
84
85 \membersection{wxSharedPtr<T>::use\_count}\label{wxsharedptruse\_count}
86
87 \constfunc{long}{use\_count}{\void}
88
89 Returns the number of pointers pointing to its object.
90
91 \membersection{wxSharedPtr<T>::reset}\label{wxsharedptrreset}
92
93 \func{void}{reset}{\param{T * }{ptr = NULL}}
94
95 Reset pointer to {\it ptr}. Afterwards the caller is responsible
96 for deleting the data contained in the pointer before.
97