From 89dfa8d7a46c992b066e5335d64089bf796e2f83 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 26 May 2010 10:46:39 +0200 Subject: Make QWeakPointer and QSharedPointer movable For making QVector of them faster. Reviewed-by: Thiago --- src/corelib/global/qglobal.h | 8 ++++++-- src/corelib/tools/qsharedpointer_impl.h | 6 +++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 7093dee..808ff44 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -2041,8 +2041,8 @@ enum { /* TYPEINFO flags */ Q_DUMMY_TYPE = 0x4 }; -#define Q_DECLARE_TYPEINFO(TYPE, FLAGS) \ -template <> \ +#define Q_DECLARE_TYPEINFO_TEMPLATE(TYPE, FLAGS, TEMPLATE_ARG) \ +template \ class QTypeInfo \ { \ public: \ @@ -2056,6 +2056,10 @@ public: \ static inline const char *name() { return #TYPE; } \ } +#define Q_DECLARE_TYPEINFO(TYPE, FLAGS) \ +Q_DECLARE_TYPEINFO_TEMPLATE(TYPE, FLAGS, ) + + template inline void qSwap(T &value1, T &value2) { diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index 550ff58..9e40bd5 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -841,9 +841,13 @@ qobject_cast(const QWeakPointer &src) { return qSharedPointerObjectCast::Type, T>(src); } - #endif + +Q_DECLARE_TYPEINFO_TEMPLATE(QWeakPointer, Q_MOVABLE_TYPE, typename T); +Q_DECLARE_TYPEINFO_TEMPLATE(QSharedPointer, Q_MOVABLE_TYPE, typename T); + + QT_END_NAMESPACE QT_END_HEADER -- cgit v0.12