OSDN Git Service

avoid temporary copy in QHash::unite()
authorIvailo Monev <xakepa10@laimg.moc>
Thu, 11 Jul 2019 00:35:14 +0000 (00:35 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Thu, 11 Jul 2019 00:35:14 +0000 (00:35 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
src/core/tools/qhash.h

index f93078e..ee29d70 100644 (file)
@@ -440,9 +440,8 @@ QHash<Key, T>::createNode(uint ah, const Key &akey, const T &avalue, Node **anex
 template <class Key, class T>
 Q_INLINE_TEMPLATE QHash<Key, T> &QHash<Key, T>::unite(const QHash<Key, T> &other)
 {
-    QHash<Key, T> copy(other);
-    const_iterator it = copy.constEnd();
-    while (it != copy.constBegin()) {
+    const_iterator it = other.constEnd();
+    while (it != other.constBegin()) {
         --it;
         insertMulti(it.key(), it.value());
     }