From 24539dc3d8054e7cb6862e5601586f837d1e21c3 Mon Sep 17 00:00:00 2001 From: Nils Jeisecke Date: Mon, 25 Jun 2012 19:13:19 +0200 Subject: [PATCH] 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 --- src/corelib/tools/qshareddata.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/corelib/tools/qshareddata.cpp b/src/corelib/tools/qshareddata.cpp index f6e1234b0fc..f5118d0e8b2 100644 --- a/src/corelib/tools/qshareddata.cpp +++ b/src/corelib/tools/qshareddata.cpp @@ -230,6 +230,14 @@ QT_BEGIN_NAMESPACE In the member function documentation, \e{d pointer} always refers 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 */