\section{KShared\-Ptr$<$ T $>$ Class Template Reference}
\label{classKSharedPtr}\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$>$}

Inheritance diagram for KShared\-Ptr$<$ T $>$:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=220pt]{classKSharedPtr__inherit__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KShared\-Ptr} ()
\item 
{\bf KShared\-Ptr} (T $\ast$t)
\item 
{\bf KShared\-Ptr} (const {\bf KShared\-Ptr} \&p)
\item 
{\bf $\sim$KShared\-Ptr} ()
\item 
{\bf KShared\-Ptr}$<$ T $>$ \& {\bf operator=} (const {\bf KShared\-Ptr}$<$ T $>$ \&p)\label{classKSharedPtr_a4}

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

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

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

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

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

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

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

\item 
T $\ast$ {\bf data} ()
\item 
const T $\ast$ {\bf data} () const 
\item 
const T \& {\bf operator $\ast$} () const \label{classKSharedPtr_a14}

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

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

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

\item 
int {\bf count} () const 
\end{CompactItemize}


\subsection{Detailed Description}
\subsubsection*{template$<$class T$>$ class 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 virtually 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.

WARNING: Please note that this class template provides an implicit conversion to T$\ast$. Do $\ast$not$\ast$ change this pointer or the pointee (don't call delete on it, for instance) behind KShared\-Ptr's back.

\begin{Desc}
\item[Author:]Waldo Bastian $<${\tt bastian@kde.org}$>$ \end{Desc}




Definition at line 100 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{classKSharedPtr_a0}


Creates a null pointer. 



Definition at line 106 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{classKSharedPtr_a1}


Creates a new pointer. 

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


Definition at line 112 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{classKSharedPtr_a2}


Copies a pointer. 

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


Definition at line 119 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{classKSharedPtr_a3}


Unreferences the object that this pointer points to. 

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

Definition at line 126 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{classKSharedPtr_a12}


Returns the pointer. 

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


Definition at line 153 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{classKSharedPtr_a13}


Returns the pointer. 

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


Definition at line 159 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{classKSharedPtr_a18}


Returns the number of references. 

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


Definition at line 170 of file ksharedptr.h.

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