\section{KShared\-Ptr$<$ T $>$ Struct Template Reference}
\label{structKSharedPtr}\index{KSharedPtr@{KSharedPtr}}
Can be used to control the lifetime of an object that has derived {\bf KShared}{\rm (p.\,\pageref{classKShared})}.  


{\tt \#include $<$ksharedptr.h$>$}

\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KShared\-Ptr} ()
\begin{CompactList}\small\item\em Creates a null pointer. \item\end{CompactList}\item 
{\bf KShared\-Ptr} (T $\ast$t)
\begin{CompactList}\small\item\em Creates a new pointer. \item\end{CompactList}\item 
{\bf KShared\-Ptr} (const  {\bf KShared\-Ptr} \&p)
\begin{CompactList}\small\item\em Copies a pointer. \item\end{CompactList}\item 
{\bf $\sim$KShared\-Ptr} ()
\begin{CompactList}\small\item\em Unreferences the object that this pointer points to. \item\end{CompactList}\item 
{\bf KShared\-Ptr}$<$ T $>$ \& {\bf operator=} (const  {\bf KShared\-Ptr}$<$ T $>$ \&p)\label{structKSharedPtr_a4}

\item 
{\bf KShared\-Ptr}$<$ T $>$ \& {\bf operator=} (T $\ast$p)\label{structKSharedPtr_a5}

\item 
bool {\bf operator==} (const  {\bf KShared\-Ptr}$<$ T $>$ \&p) const \label{structKSharedPtr_a6}

\item 
bool {\bf operator!=} (const  {\bf KShared\-Ptr}$<$ T $>$ \&p) const \label{structKSharedPtr_a7}

\item 
bool {\bf operator==} (const  T $\ast$p) const \label{structKSharedPtr_a8}

\item 
bool {\bf operator!=} (const  T $\ast$p) const \label{structKSharedPtr_a9}

\item 
bool {\bf operator!} () const \label{structKSharedPtr_a10}

\item 
{\bf operator T $\ast$} () const \label{structKSharedPtr_a11}

\item 
T $\ast$ {\bf data} ()
\begin{CompactList}\small\item\em Returns the pointer. \item\end{CompactList}\item 
const  T $\ast$ {\bf data} () const 
\begin{CompactList}\small\item\em Returns the pointer. \item\end{CompactList}\item 
const  T \& {\bf operator $\ast$} () const \label{structKSharedPtr_a14}

\item 
T \& {\bf operator $\ast$} ()\label{structKSharedPtr_a15}

\item 
const  T $\ast$ {\bf operator $\rightarrow$ } () const \label{structKSharedPtr_a16}

\item 
T $\ast$ {\bf operator $\rightarrow$ } ()\label{structKSharedPtr_a17}

\item 
int {\bf count} () const 
\begin{CompactList}\small\item\em Returns the number of references. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
\subsubsection*{template$<$class T$>$ struct KShared\-Ptr$<$ T $>$}

Can be used to control the lifetime of an object that has derived {\bf KShared}{\rm (p.\,\pageref{classKShared})}. 

As long a someone holds a KShared\-Ptr on some {\bf KShared}{\rm (p.\,\pageref{classKShared})} object it won't become deleted but is deleted once its reference count is 0. This struct emulates C++ pointers perfectly. So just use it like a simple C++ pointer.

{\bf KShared}{\rm (p.\,\pageref{classKShared})} and KShared\-Ptr are preferred over QShared / QShared\-Ptr since they are more safe.

\begin{Desc}
\item[Author:]Waldo Bastian $<${\tt bastian@kde.org}$>$ \end{Desc}
\begin{Desc}
\item[Version:]\begin{Desc}
\item[Id]{\bf ksharedptr.h}{\rm (p.\,\pageref{ksharedptr_8h})},v 1.20 2002/09/08 14:55:42 tjansen Exp \end{Desc}
\end{Desc}




Definition at line 96 of file ksharedptr.h.

\subsection{Constructor \& Destructor Documentation}
\index{KSharedPtr@{KShared\-Ptr}!KSharedPtr@{KSharedPtr}}
\index{KSharedPtr@{KSharedPtr}!KSharedPtr@{KShared\-Ptr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class T$>$ {\bf KShared\-Ptr}$<$ T $>$::{\bf KShared\-Ptr} ()\hspace{0.3cm}{\tt  [inline]}}\label{structKSharedPtr_a0}


Creates a null pointer. 



Definition at line 102 of file ksharedptr.h.\index{KSharedPtr@{KShared\-Ptr}!KSharedPtr@{KSharedPtr}}
\index{KSharedPtr@{KSharedPtr}!KSharedPtr@{KShared\-Ptr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class T$>$ {\bf KShared\-Ptr}$<$ T $>$::{\bf KShared\-Ptr} (T $\ast$ {\em t})\hspace{0.3cm}{\tt  [inline]}}\label{structKSharedPtr_a1}


Creates a new pointer. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em the}]pointer \end{description}
\end{Desc}


Definition at line 108 of file ksharedptr.h.\index{KSharedPtr@{KShared\-Ptr}!KSharedPtr@{KSharedPtr}}
\index{KSharedPtr@{KSharedPtr}!KSharedPtr@{KShared\-Ptr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class T$>$ {\bf KShared\-Ptr}$<$ T $>$::{\bf KShared\-Ptr} (const {\bf KShared\-Ptr}$<$ T $>$ \& {\em p})\hspace{0.3cm}{\tt  [inline]}}\label{structKSharedPtr_a2}


Copies a pointer. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em the}]pointer to copy \end{description}
\end{Desc}


Definition at line 115 of file ksharedptr.h.\index{KSharedPtr@{KShared\-Ptr}!~KSharedPtr@{$\sim$KSharedPtr}}
\index{~KSharedPtr@{$\sim$KSharedPtr}!KSharedPtr@{KShared\-Ptr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class T$>$ {\bf KShared\-Ptr}$<$ T $>$::$\sim${\bf KShared\-Ptr} ()\hspace{0.3cm}{\tt  [inline]}}\label{structKSharedPtr_a3}


Unreferences the object that this pointer points to. 

If it was the last reference, the object will be deleted. 

Definition at line 122 of file ksharedptr.h.

\subsection{Member Function Documentation}
\index{KSharedPtr@{KShared\-Ptr}!data@{data}}
\index{data@{data}!KSharedPtr@{KShared\-Ptr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class T$>$ T$\ast$ {\bf KShared\-Ptr}$<$ T $>$::data ()\hspace{0.3cm}{\tt  [inline]}}\label{structKSharedPtr_a12}


Returns the pointer. 

\begin{Desc}
\item[Returns:]the pointer \end{Desc}


Definition at line 149 of file ksharedptr.h.\index{KSharedPtr@{KShared\-Ptr}!data@{data}}
\index{data@{data}!KSharedPtr@{KShared\-Ptr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class T$>$ const T$\ast$ {\bf KShared\-Ptr}$<$ T $>$::data () const\hspace{0.3cm}{\tt  [inline]}}\label{structKSharedPtr_a13}


Returns the pointer. 

\begin{Desc}
\item[Returns:]the pointer \end{Desc}


Definition at line 155 of file ksharedptr.h.\index{KSharedPtr@{KShared\-Ptr}!count@{count}}
\index{count@{count}!KSharedPtr@{KShared\-Ptr}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}template$<$class T$>$ int {\bf KShared\-Ptr}$<$ T $>$::count () const\hspace{0.3cm}{\tt  [inline]}}\label{structKSharedPtr_a18}


Returns the number of references. 

\begin{Desc}
\item[Returns:]the number of references \end{Desc}


Definition at line 166 of file ksharedptr.h.

The documentation for this struct was generated from the following file:\begin{CompactItemize}
\item 
ksharedptr.h\end{CompactItemize}
