Skip to content

Commit

Permalink
Mark QHash/QMap as relocatable and movable-come-Qt 6
Browse files Browse the repository at this point in the history
They were forgotten from the movable containers for Qt 5.0.
Make sure we don't forget for 6.0, either.

Until then, mark with new Q_RELOCATABLE_TYPE.

Change-Id: I279a96c02a718a1432040303bb0d001739f59a17
Reviewed-by: Thiago Macieira <[email protected]>
  • Loading branch information
marc-kdab committed Feb 9, 2016
1 parent 488cf78 commit 3e63a58
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/corelib/global/qtypeinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,32 @@ Q_DECLARE_MOVABLE_CONTAINER(QSet);

#undef Q_DECLARE_MOVABLE_CONTAINER

/* These cannot be movable before ### Qt 6, for BC reasons */
#define Q_DECLARE_MOVABLE_CONTAINER(CONTAINER) \
template <typename K, typename V> class CONTAINER; \
template <typename K, typename V> \
class QTypeInfo< CONTAINER<K, V> > \
{ \
public: \
enum { \
isPointer = false, \
isIntegral = false, \
isComplex = true, \
isStatic = (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)), \
isRelocatable = true, \
isLarge = (sizeof(CONTAINER<K, V>) > sizeof(void*)), \
isDummy = false, \
sizeOf = sizeof(CONTAINER<K, V>) \
}; \
}

Q_DECLARE_MOVABLE_CONTAINER(QMap);
Q_DECLARE_MOVABLE_CONTAINER(QMultiMap);
Q_DECLARE_MOVABLE_CONTAINER(QHash);
Q_DECLARE_MOVABLE_CONTAINER(QMultiHash);

#undef Q_DECLARE_MOVABLE_CONTAINER

/*
Specialize a specific type with:
Expand Down

0 comments on commit 3e63a58

Please sign in to comment.