.BI "QDeepCopy<T> & \fBoperator=\fR ( const T & t )"
.br
.ti -1c
.BI "\fBoperator T\fR ()"
.br
.in -1c
.SH DESCRIPTION
The QDeepCopy class is a template class which ensures that implicitly shared and explicitly shared classes reference unique data.
.PP
Normally, shared copies reference the same data to optimize memory use and for maximum speed. In the example below, \fCs1\fR, \fCs2\fR, \fCs3\fR, \fCs4\fR and \fCs5\fR share data.
QDeepCopy can be used several ways to ensure that an object references unique, unshared data. In the example below, \fCs1\fR, \fCs2\fR and \fCs5\fR share data, while neither \fCs3\fR nor \fCs4\fR share data.
.PP
.nf
.br
// s1, s2 and s5 share the same data, neither s3 nor s4 are shared
QDeepCopy can also provide safety in multithreaded applications that use shared classes. In the example below, the variable \fCglobal_string\fR is used safely since the data contained in \fCglobal_string\fR is always a deep copy. This ensures that all threads get a unique copy of the data, and that any assignments to \fCglobal_string\fR will result in a deep copy.
The examples above use TQString, which is an implicitly shared class. The behavior of QDeepCopy is the same when using explicitly shared classes like QByteArray.