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
},
27 \helpref{wxObjectDataPtr
}{wxobjectdataptr
}
30 \latexignore{\rtfignore{\wxheading{Members
}}}
33 \membersection{wxSharedPtr<T>::wxSharedPtr<T>
}\label{wxsharedptrwxsharedptr
}
35 \func{wxEXPLICIT
}{wxSharedPtr<T>
}{\param{T*
}{ptr = NULL
}}
37 \func{}{wxSharedPtr<T>
}{\param{const wxSharedPtr<T>\&
}{tocopy
}}
41 \membersection{wxSharedPtr<T>::
\destruct{wxSharedPtr<T>
}}\label{wxsharedptrdtor
}
43 \func{}{\destruct{wxSharedPtr<T>
}}{\void}
47 \membersection{wxSharedPtr<T>::get
}\label{wxsharedptrget
}
49 \constfunc{T*
}{get
}{\void}
51 Returns pointer to its object or NULL.
53 \membersection{wxSharedPtr<T>::operator unspecified
\_bool\_type}\label{wxsharedptroperatorbool
}
55 \constfunc{}{operator unspecified
\_bool\_type}{\void}
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
}.
62 \membersection{wxSharedPtr<T>::operator*
}\label{wxsharedptroperatorreft
}
64 \constfunc{T\&
}{operator*
}{\void}
66 Returns a reference to the object. If the internal pointer is NULL this
67 method will cause an assert in debug mode.
69 \membersection{wxSharedPtr<T>::operator->
}\label{wxsharedptroperatorderef
}
71 \constfunc{T*
}{operator->
}{\void}
73 Returns pointer to its object or NULL.
75 \membersection{wxSharedPtr<T>::operator=
}\label{wxsharedptroperatorassign
}
77 \func{wxSharedPtr<T>\& operator
}{operator=
}{\param{const wxSharedPtr<T>\&
}{tocopy
}}
79 Assignment operator. Releases any previously held pointer
80 and creates a reference to the same object as
{\it topcopy
}.
82 \membersection{wxSharedPtr<T>::operator=
}\label{wxsharedptroperatorassign2
}
84 \func{wxSharedPtr<T>\& operator
}{operator=
}{\param{T *
}{ptr
}}
86 Assignment operator. Releases any previously held pointer
87 and creates a reference to
{\it ptr
}.
89 \membersection{wxSharedPtr<T>::unique
}\label{wxsharedptrunique
}
91 \constfunc{bool
}{unique
}{\void}
93 Returns true if this is the only pointer pointing to its object.
95 \membersection{wxSharedPtr<T>::use
\_count}\label{wxsharedptruse
\_count}
97 \constfunc{long
}{use
\_count}{\void}
99 Returns the number of pointers pointing to its object.
101 \membersection{wxSharedPtr<T>::reset
}\label{wxsharedptrreset
}
103 \func{void
}{reset
}{\param{T *
}{ptr = NULL
}}
105 Reset pointer to
{\it ptr
}. If the reference count of the
106 previously owned pointer was
1 it will be deleted.