From 7d75a4850716423c31fd10ddd85fe82e974b695d Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Sun, 25 Oct 2020 14:12:31 +0100 Subject: [PATCH] Cleanup container declarations in qtypeinfo.h Use variadic templates to avoid having to use several macros to declare movable containers. Add missing movable declaration for QCache. Change-Id: I32d6a399ef8e6c39021df04deedfbbf0c526fc84 Reviewed-by: Fabian Kosmale Reviewed-by: Thiago Macieira --- src/corelib/global/qtypeinfo.h | 23 +++-------------------- src/corelib/tools/qcontainerfwd.h | 4 ++-- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/src/corelib/global/qtypeinfo.h b/src/corelib/global/qtypeinfo.h index 04b918f4213..f3382ea17ee 100644 --- a/src/corelib/global/qtypeinfo.h +++ b/src/corelib/global/qtypeinfo.h @@ -117,9 +117,8 @@ public: }; #define Q_DECLARE_MOVABLE_CONTAINER(CONTAINER) \ -template class CONTAINER; \ -template \ -class QTypeInfo< CONTAINER > \ +template \ +class QTypeInfo> \ { \ public: \ enum { \ @@ -134,27 +133,11 @@ Q_DECLARE_MOVABLE_CONTAINER(QList); Q_DECLARE_MOVABLE_CONTAINER(QQueue); Q_DECLARE_MOVABLE_CONTAINER(QStack); Q_DECLARE_MOVABLE_CONTAINER(QSet); - -#undef Q_DECLARE_MOVABLE_CONTAINER - -#define Q_DECLARE_MOVABLE_CONTAINER(CONTAINER) \ -template class CONTAINER; \ -template \ -class QTypeInfo< CONTAINER > \ -{ \ -public: \ - enum { \ - isPointer = false, \ - isIntegral = false, \ - isComplex = true, \ - isRelocatable = true, \ - }; \ -} - Q_DECLARE_MOVABLE_CONTAINER(QMap); Q_DECLARE_MOVABLE_CONTAINER(QMultiMap); Q_DECLARE_MOVABLE_CONTAINER(QHash); Q_DECLARE_MOVABLE_CONTAINER(QMultiHash); +Q_DECLARE_MOVABLE_CONTAINER(QCache); #undef Q_DECLARE_MOVABLE_CONTAINER diff --git a/src/corelib/tools/qcontainerfwd.h b/src/corelib/tools/qcontainerfwd.h index a104b119652..b9a50e4d60e 100644 --- a/src/corelib/tools/qcontainerfwd.h +++ b/src/corelib/tools/qcontainerfwd.h @@ -37,11 +37,11 @@ ** ****************************************************************************/ +#include + #ifndef QCONTAINERFWD_H #define QCONTAINERFWD_H -#include - // std headers can unfortunately not be forward declared #include #include