Enhanced QSharedDataPointer documentation with container performance section

Added a section motivating the use of Q_DECLARE_TYPEINFO to mark
shared data classes as movable types.

Change-Id: I26664500aef7d83d779d90f97f3f2b0043966480
Reviewed-by: Casper van Donderen <casper.vandonderen@gmail.com>
This commit is contained in:
Nils Jeisecke 2012-06-25 19:13:19 +02:00 committed by The Qt Project
parent bad43f1e3d
commit 24539dc3d8

View File

@ -230,6 +230,14 @@ QT_BEGIN_NAMESPACE
In the member function documentation, \e{d pointer} always refers In the member function documentation, \e{d pointer} always refers
to the internal pointer to the shared data object. to the internal pointer to the shared data object.
\section1 Optimize performance for usage in Qt Containers
You should consider marking your implicitly shared class as a movable type
using the Q_DECLARE_TYPEINFO() macro if it resembles the \c Employee class
above and uses a QSharedDataPointer or QExplicitlySharedDataPointer as the
only member. This can improve performance and memory efficiency when using
Qt's \l{container classes}.
\sa QSharedData, QExplicitlySharedDataPointer, QScopedPointer, QSharedPointer \sa QSharedData, QExplicitlySharedDataPointer, QScopedPointer, QSharedPointer
*/ */