]> git.saurik.com Git - wxWidgets.git/blob - docs/latex/wx/sharedptr.tex
added wxGLCanvas::IsDisplaySupported() (patch 1879906)
[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 \helpref{wxObjectDataPtr}{wxobjectdataptr}
28
29
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
39 Constructors.
40
41 \membersection{wxSharedPtr<T>::\destruct{wxSharedPtr<T>}}\label{wxsharedptrdtor}
42
43 \func{}{\destruct{wxSharedPtr<T>}}{\void}
44
45 Destructor.
46
47 \membersection{wxSharedPtr<T>::get}\label{wxsharedptrget}
48
49 \constfunc{T*}{get}{\void}
50
51 Returns pointer to its object or NULL.
52
53 \membersection{wxSharedPtr<T>::operator unspecified\_bool\_type}\label{wxsharedptroperatorbool}
54
55 \constfunc{}{operator unspecified\_bool\_type}{\void}
56
57 Conversion to a boolean expression (in a variant which is not
58 convertable to anything but a boolean expression). If this class
59 contains a valid pointer it will return {\it true}, if it contains
60 a NULL pointer it will return {\it false}.
61
62 \membersection{wxSharedPtr<T>::operator*}\label{wxsharedptroperatorreft}
63
64 \constfunc{T\&}{operator*}{\void}
65
66 Returns a reference to the object. If the internal pointer is NULL this
67 method will cause an assert in debug mode.
68
69 \membersection{wxSharedPtr<T>::operator->}\label{wxsharedptroperatorderef}
70
71 \constfunc{T*}{operator->}{\void}
72
73 Returns 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
79 Assignment operator. Releases any previously held pointer
80 and creates a reference to the same object as {\it topcopy}.
81
82 \membersection{wxSharedPtr<T>::operator=}\label{wxsharedptroperatorassign2}
83
84 \func{wxSharedPtr<T>\& operator}{operator=}{\param{T *}{ptr}}
85
86 Assignment operator. Releases any previously held pointer
87 and creates a reference to {\it ptr}.
88
89 \membersection{wxSharedPtr<T>::unique}\label{wxsharedptrunique}
90
91 \constfunc{bool}{unique}{\void}
92
93 Returns 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
99 Returns the number of pointers pointing to its object.
100
101 \membersection{wxSharedPtr<T>::reset}\label{wxsharedptrreset}
102
103 \func{void}{reset}{\param{T * }{ptr = NULL}}
104
105 Reset pointer to {\it ptr}. If the reference count of the
106 previously owned pointer was 1 it will be deleted.
107