1 \section{\class{wxSharedPtr<T>
}}\label{wxsharedptr
}
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
}.
8 \wxheading{Derived from
}
12 \wxheading{Include files
}
16 \wxheading{Data structures
}
20 typedef T element_type
26 \helpref{wxScopedPtr
}{wxscopedptrtemplate
},
\helpref{wxWeakRef
}{wxweakref
}
29 \latexignore{\rtfignore{\wxheading{Members
}}}
32 \membersection{wxSharedPtr<T>::wxSharedPtr<T>
}\label{wxsharedptrwxsharedptr
}
34 \func{wxEXPLICIT
}{wxSharedPtr<T>
}{\param{T*
}{ptr = NULL
}}
36 \func{}{wxSharedPtr<T>
}{\param{const wxSharedPtr<T>\&
}{tocopy
}}
40 \membersection{wxSharedPtr<T>::
\destruct{wxSharedPtr<T>
}}\label{wxsharedptrdtor
}
42 \func{}{\destruct{wxSharedPtr<T>
}}{\void}
46 \membersection{wxSharedPtr<T>::get
}\label{wxsharedptrget
}
48 \constfunc{T*
}{get
}{\void}
50 Returns pointer to its object or NULL.
52 \membersection{wxSharedPtr<T>::operator unspecified
\_bool\_type}\label{wxsharedptroperatorbool
}
54 \constfunc{}{operator unspecified
\_bool\_type}{\void}
56 Conversion to a boolean expression (in a variant which is not
57 convertable to anything but a boolean expression). If this class
58 contains a valid pointer it will return
{\it true
}, if it contains
59 a NULL pointer it will return
{\it false
}.
61 \membersection{wxSharedPtr<T>::operator*
}\label{wxsharedptroperatorreft
}
63 \constfunc{T\&
}{operator*
}{\void}
65 Returns a reference to the object. If the internal pointer is NULL this
66 method will cause an assert in debug mode.
68 \membersection{wxSharedPtr<T>::operator->
}\label{wxsharedptroperatorderef
}
70 \constfunc{T*
}{operator->
}{\void}
72 Returns pointer to its object or NULL.
74 \membersection{wxSharedPtr<T>::operator=
}\label{wxsharedptroperatorassign
}
76 \func{wxSharedPtr<T>\& operator
}{operator=
}{\param{const wxSharedPtr<T>\&
}{tocopy
}}
78 Assignment operator. Releases any previously held pointer
79 and creates a reference to same object as
{\it topcopy
}.
81 \membersection{wxSharedPtr<T>::operator=
}\label{wxsharedptroperatorassign2
}
83 \func{wxSharedPtr<T>\& operator
}{operator=
}{\param{T *
}{ptr
}}
85 Assignment operator. Releases any previously held pointer
86 and creates a reference to
{\it ptr
}.
88 \membersection{wxSharedPtr<T>::unique
}\label{wxsharedptrunique
}
90 \constfunc{bool
}{unique
}{\void}
92 Returns true if this is the only pointer pointing to its object.
94 \membersection{wxSharedPtr<T>::use
\_count}\label{wxsharedptruse
\_count}
96 \constfunc{long
}{use
\_count}{\void}
98 Returns the number of pointers pointing to its object.
100 \membersection{wxSharedPtr<T>::reset
}\label{wxsharedptrreset
}
102 \func{void
}{reset
}{\param{T *
}{ptr = NULL
}}
104 Reset pointer to
{\it ptr
}. Afterwards the caller is responsible
105 for deleting the data contained in the pointer before.