summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/global/qglobal.h9
-rw-r--r--src/corelib/io/qdebug.h2
-rw-r--r--src/corelib/io/qdir.h2
-rw-r--r--src/corelib/io/qfileinfo.h2
-rw-r--r--src/corelib/io/qprocess.h2
-rw-r--r--src/corelib/io/qstorageinfo.h2
-rw-r--r--src/corelib/io/qurl.h2
-rw-r--r--src/corelib/io/qurlquery.h2
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.h2
-rw-r--r--src/corelib/itemmodels/qitemselectionmodel.h4
-rw-r--r--src/corelib/kernel/qbasictimer.h2
-rw-r--r--src/corelib/kernel/qdeadlinetimer.h2
-rw-r--r--src/corelib/kernel/qobjectdefs.h2
-rw-r--r--src/corelib/kernel/qpropertyprivate.h2
-rw-r--r--src/corelib/mimetypes/qmimetype.h2
-rw-r--r--src/corelib/serialization/qcborarray.h2
-rw-r--r--src/corelib/serialization/qcbormap.h2
-rw-r--r--src/corelib/serialization/qcborvalue.h6
-rw-r--r--src/corelib/serialization/qjsonarray.h2
-rw-r--r--src/corelib/serialization/qjsonobject.h2
-rw-r--r--src/corelib/serialization/qxmlstream.h4
-rw-r--r--src/corelib/text/qbytearray.h6
-rw-r--r--src/corelib/text/qcollator.h2
-rw-r--r--src/corelib/text/qlocale.h2
-rw-r--r--src/corelib/text/qstring.h2
-rw-r--r--src/corelib/thread/qexception.h2
-rw-r--r--src/corelib/thread/qpromise.h2
-rw-r--r--src/corelib/thread/qsemaphore.h4
-rw-r--r--src/corelib/tools/qarraydatapointer.h6
-rw-r--r--src/corelib/tools/qbitarray.h2
-rw-r--r--src/corelib/tools/qcache.h4
-rw-r--r--src/corelib/tools/qcommandlineoption.h2
-rw-r--r--src/corelib/tools/qcontiguouscache.h2
-rw-r--r--src/corelib/tools/qeasingcurve.h2
-rw-r--r--src/corelib/tools/qhash.h9
-rw-r--r--src/corelib/tools/qlist.h2
-rw-r--r--src/corelib/tools/qmap.h4
-rw-r--r--src/corelib/tools/qscopedpointer.h2
-rw-r--r--src/corelib/tools/qshareddata.h4
-rw-r--r--src/corelib/tools/qshareddata_impl.h2
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h12
-rw-r--r--src/corelib/tools/qtaggedpointer.h2
-rw-r--r--src/corelib/tools/qversionnumber.h2
43 files changed, 74 insertions, 60 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index d686bbdb8a..ad771d4f5f 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -1174,6 +1174,15 @@ constexpr void qSwap(T &value1, T &value2)
swap(value1, value2);
}
+// pure compile-time micro-optimization for our own headers, so not documented:
+template <typename T>
+constexpr inline void qt_ptr_swap(T* &lhs, T* &rhs) noexcept
+{
+ T *tmp = lhs;
+ lhs = rhs;
+ rhs = tmp;
+}
+
QT_WARNING_POP
Q_CORE_EXPORT void *qMallocAligned(size_t size, size_t alignment) Q_ALLOC_SIZE(1);
diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h
index bfcdf42f0d..2647f3da0f 100644
--- a/src/corelib/io/qdebug.h
+++ b/src/corelib/io/qdebug.h
@@ -105,7 +105,7 @@ public:
inline QDebug &operator=(const QDebug &other);
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QDebug)
~QDebug();
- inline void swap(QDebug &other) noexcept { qSwap(stream, other.stream); }
+ void swap(QDebug &other) noexcept { qt_ptr_swap(stream, other.stream); }
QDebug &resetFormat();
diff --git a/src/corelib/io/qdir.h b/src/corelib/io/qdir.h
index 38a4d8d961..7d7a483eae 100644
--- a/src/corelib/io/qdir.h
+++ b/src/corelib/io/qdir.h
@@ -124,7 +124,7 @@ public:
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QDir)
void swap(QDir &other) noexcept
- { qSwap(d_ptr, other.d_ptr); }
+ { d_ptr.swap(other.d_ptr); }
void setPath(const QString &path);
#ifdef Q_CLANG_QDOC
diff --git a/src/corelib/io/qfileinfo.h b/src/corelib/io/qfileinfo.h
index 4bc5db9e2b..b54a24e563 100644
--- a/src/corelib/io/qfileinfo.h
+++ b/src/corelib/io/qfileinfo.h
@@ -91,7 +91,7 @@ public:
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QFileInfo)
void swap(QFileInfo &other) noexcept
- { qSwap(d_ptr, other.d_ptr); }
+ { d_ptr.swap(other.d_ptr); }
bool operator==(const QFileInfo &fileinfo) const;
inline bool operator!=(const QFileInfo &fileinfo) const { return !(operator==(fileinfo)); }
diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h
index 50740c092b..97b586a2b4 100644
--- a/src/corelib/io/qprocess.h
+++ b/src/corelib/io/qprocess.h
@@ -74,7 +74,7 @@ public:
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QProcessEnvironment)
QProcessEnvironment &operator=(const QProcessEnvironment &other);
- void swap(QProcessEnvironment &other) noexcept { qSwap(d, other.d); }
+ void swap(QProcessEnvironment &other) noexcept { d.swap(other.d); }
bool operator==(const QProcessEnvironment &other) const;
inline bool operator!=(const QProcessEnvironment &other) const
diff --git a/src/corelib/io/qstorageinfo.h b/src/corelib/io/qstorageinfo.h
index d441915a9e..fc440fa05e 100644
--- a/src/corelib/io/qstorageinfo.h
+++ b/src/corelib/io/qstorageinfo.h
@@ -65,7 +65,7 @@ public:
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QStorageInfo)
inline void swap(QStorageInfo &other) noexcept
- { qSwap(d, other.d); }
+ { d.swap(other.d); }
void setPath(const QString &path);
diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h
index 62b8e8cd93..3001904ef3 100644
--- a/src/corelib/io/qurl.h
+++ b/src/corelib/io/qurl.h
@@ -192,7 +192,7 @@ public:
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QUrl)
~QUrl();
- inline void swap(QUrl &other) noexcept { qSwap(d, other.d); }
+ void swap(QUrl &other) noexcept { qt_ptr_swap(d, other.d); }
void setUrl(const QString &url, ParsingMode mode = TolerantMode);
QString url(FormattingOptions options = FormattingOptions(PrettyDecoded)) const;
diff --git a/src/corelib/io/qurlquery.h b/src/corelib/io/qurlquery.h
index aba5df6a57..e509f77cd2 100644
--- a/src/corelib/io/qurlquery.h
+++ b/src/corelib/io/qurlquery.h
@@ -74,7 +74,7 @@ public:
bool operator!=(const QUrlQuery &other) const
{ return !(*this == other); }
- void swap(QUrlQuery &other) noexcept { qSwap(d, other.d); }
+ void swap(QUrlQuery &other) noexcept { d.swap(other.d); }
bool isEmpty() const;
bool isDetached() const;
diff --git a/src/corelib/itemmodels/qabstractitemmodel.h b/src/corelib/itemmodels/qabstractitemmodel.h
index a8d8a7de4b..439e63a362 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.h
+++ b/src/corelib/itemmodels/qabstractitemmodel.h
@@ -222,7 +222,7 @@ public:
inline QPersistentModelIndex(QPersistentModelIndex &&other) noexcept
: d(qExchange(other.d, nullptr)) {}
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QPersistentModelIndex)
- inline void swap(QPersistentModelIndex &other) noexcept { qSwap(d, other.d); }
+ void swap(QPersistentModelIndex &other) noexcept { qt_ptr_swap(d, other.d); }
bool operator==(const QModelIndex &other) const;
bool operator!=(const QModelIndex &other) const;
QPersistentModelIndex &operator=(const QModelIndex &other);
diff --git a/src/corelib/itemmodels/qitemselectionmodel.h b/src/corelib/itemmodels/qitemselectionmodel.h
index 678ba8bbad..1d3fb0ec2a 100644
--- a/src/corelib/itemmodels/qitemselectionmodel.h
+++ b/src/corelib/itemmodels/qitemselectionmodel.h
@@ -60,8 +60,8 @@ public:
void swap(QItemSelectionRange &other) noexcept
{
- qSwap(tl, other.tl);
- qSwap(br, other.br);
+ tl.swap(other.tl);
+ br.swap(other.br);
}
inline int top() const { return tl.row(); }
diff --git a/src/corelib/kernel/qbasictimer.h b/src/corelib/kernel/qbasictimer.h
index 6a2728dd56..0d58964124 100644
--- a/src/corelib/kernel/qbasictimer.h
+++ b/src/corelib/kernel/qbasictimer.h
@@ -63,7 +63,7 @@ public:
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QBasicTimer)
- void swap(QBasicTimer &other) noexcept { qSwap(id, other.id); }
+ void swap(QBasicTimer &other) noexcept { std::swap(id, other.id); }
bool isActive() const noexcept { return id != 0; }
int timerId() const noexcept { return id; }
diff --git a/src/corelib/kernel/qdeadlinetimer.h b/src/corelib/kernel/qdeadlinetimer.h
index 08e80e448c..0720a32b56 100644
--- a/src/corelib/kernel/qdeadlinetimer.h
+++ b/src/corelib/kernel/qdeadlinetimer.h
@@ -70,7 +70,7 @@ public:
explicit QDeadlineTimer(qint64 msecs, Qt::TimerType type = Qt::CoarseTimer) noexcept;
void swap(QDeadlineTimer &other) noexcept
- { qSwap(t1, other.t1); qSwap(t2, other.t2); qSwap(type, other.type); }
+ { std::swap(t1, other.t1); std::swap(t2, other.t2); std::swap(type, other.type); }
constexpr bool isForever() const noexcept
{ return t1 == (std::numeric_limits<qint64>::max)(); }
diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h
index 00a6b62eab..6ffdb2a5de 100644
--- a/src/corelib/kernel/qobjectdefs.h
+++ b/src/corelib/kernel/qobjectdefs.h
@@ -463,7 +463,7 @@ public:
Connection(Connection &&other) noexcept : d_ptr(qExchange(other.d_ptr, nullptr)) {}
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(Connection)
- void swap(Connection &other) noexcept { qSwap(d_ptr, other.d_ptr); }
+ void swap(Connection &other) noexcept { qt_ptr_swap(d_ptr, other.d_ptr); }
};
inline void swap(QMetaObject::Connection &lhs, QMetaObject::Connection &rhs) noexcept
diff --git a/src/corelib/kernel/qpropertyprivate.h b/src/corelib/kernel/qpropertyprivate.h
index 1c7f13046f..8fe8cc7ff2 100644
--- a/src/corelib/kernel/qpropertyprivate.h
+++ b/src/corelib/kernel/qpropertyprivate.h
@@ -121,7 +121,7 @@ public:
bool operator!() const noexcept { return d == nullptr; }
void swap(QPropertyBindingPrivatePtr &other) noexcept
- { qSwap(d, other.d); }
+ { qt_ptr_swap(d, other.d); }
friend bool operator==(const QPropertyBindingPrivatePtr &p1, const QPropertyBindingPrivatePtr &p2) noexcept
{ return p1.d == p2.d; }
diff --git a/src/corelib/mimetypes/qmimetype.h b/src/corelib/mimetypes/qmimetype.h
index 365808e48b..7424bcdf7a 100644
--- a/src/corelib/mimetypes/qmimetype.h
+++ b/src/corelib/mimetypes/qmimetype.h
@@ -81,7 +81,7 @@ public:
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QMimeType)
void swap(QMimeType &other) noexcept
{
- qSwap(d, other.d);
+ d.swap(other.d);
}
explicit QMimeType(const QMimeTypePrivate &dd);
~QMimeType();
diff --git a/src/corelib/serialization/qcborarray.h b/src/corelib/serialization/qcborarray.h
index dd0628b3bb..63f54dc2a5 100644
--- a/src/corelib/serialization/qcborarray.h
+++ b/src/corelib/serialization/qcborarray.h
@@ -176,7 +176,7 @@ public:
void swap(QCborArray &other) noexcept
{
- qSwap(d, other.d);
+ d.swap(other.d);
}
QCborValue toCborValue() const { return *this; }
diff --git a/src/corelib/serialization/qcbormap.h b/src/corelib/serialization/qcbormap.h
index f84552d992..ed9c2f21d5 100644
--- a/src/corelib/serialization/qcbormap.h
+++ b/src/corelib/serialization/qcbormap.h
@@ -178,7 +178,7 @@ public:
void swap(QCborMap &other) noexcept
{
- qSwap(d, other.d);
+ d.swap(other.d);
}
QCborValue toCborValue() const { return *this; }
diff --git a/src/corelib/serialization/qcborvalue.h b/src/corelib/serialization/qcborvalue.h
index 9a26c9ab66..6a1558e2b5 100644
--- a/src/corelib/serialization/qcborvalue.h
+++ b/src/corelib/serialization/qcborvalue.h
@@ -187,9 +187,9 @@ public:
void swap(QCborValue &other) noexcept
{
- qSwap(n, other.n);
- qSwap(container, other.container);
- qSwap(t, other.t);
+ std::swap(n, other.n);
+ qt_ptr_swap(container, other.container);
+ std::swap(t, other.t);
}
Type type() const { return t; }
diff --git a/src/corelib/serialization/qjsonarray.h b/src/corelib/serialization/qjsonarray.h
index 406fbc2f47..462a7c76d8 100644
--- a/src/corelib/serialization/qjsonarray.h
+++ b/src/corelib/serialization/qjsonarray.h
@@ -101,7 +101,7 @@ public:
void swap(QJsonArray &other) noexcept
{
- qSwap(a, other.a);
+ a.swap(other.a);
}
class const_iterator;
diff --git a/src/corelib/serialization/qjsonobject.h b/src/corelib/serialization/qjsonobject.h
index e477345643..25912779ed 100644
--- a/src/corelib/serialization/qjsonobject.h
+++ b/src/corelib/serialization/qjsonobject.h
@@ -74,7 +74,7 @@ public:
void swap(QJsonObject &other) noexcept
{
- qSwap(o, other.o);
+ o.swap(other.o);
}
static QJsonObject fromVariantMap(const QVariantMap &map);
diff --git a/src/corelib/serialization/qxmlstream.h b/src/corelib/serialization/qxmlstream.h
index afd8563cc1..ed2da2e513 100644
--- a/src/corelib/serialization/qxmlstream.h
+++ b/src/corelib/serialization/qxmlstream.h
@@ -58,12 +58,12 @@ public:
QXmlString(QStringPrivate &&d) : m_string(std::move(d)) {}
QXmlString(const QString &s) : m_string(s.data_ptr()) {}
QXmlString & operator=(const QString &s) { m_string = s.data_ptr(); return *this; }
- QXmlString & operator=(QString &&s) { qSwap(m_string, s.data_ptr()); return *this; }
+ QXmlString & operator=(QString &&s) { m_string.swap(s.data_ptr()); return *this; }
inline constexpr QXmlString() {}
void swap(QXmlString &other) noexcept
{
- qSwap(m_string, other.m_string);
+ m_string.swap(other.m_string);
}
inline operator QStringView() const { return QStringView(m_string.data(), m_string.size); }
diff --git a/src/corelib/text/qbytearray.h b/src/corelib/text/qbytearray.h
index dbbbd2f178..d3b3c3ca6e 100644
--- a/src/corelib/text/qbytearray.h
+++ b/src/corelib/text/qbytearray.h
@@ -124,7 +124,7 @@ public:
{ qSwap(d, other.d); }
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QByteArray)
inline void swap(QByteArray &other) noexcept
- { qSwap(d, other.d); }
+ { d.swap(other.d); }
bool isEmpty() const noexcept { return size() == 0; }
void resize(qsizetype size);
@@ -629,8 +629,8 @@ public:
void swap(QByteArray::FromBase64Result &other) noexcept
{
- qSwap(decoded, other.decoded);
- qSwap(decodingStatus, other.decodingStatus);
+ decoded.swap(other.decoded);
+ std::swap(decodingStatus, other.decodingStatus);
}
explicit operator bool() const noexcept { return decodingStatus == QByteArray::Base64DecodingStatus::Ok; }
diff --git a/src/corelib/text/qcollator.h b/src/corelib/text/qcollator.h
index ddfbacfd19..a0333e6f07 100644
--- a/src/corelib/text/qcollator.h
+++ b/src/corelib/text/qcollator.h
@@ -87,7 +87,7 @@ public:
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_MOVE_AND_SWAP(QCollator)
void swap(QCollator &other) noexcept
- { qSwap(d, other.d); }
+ { qt_ptr_swap(d, other.d); }
void setLocale(const QLocale &locale);
QLocale locale() const;
diff --git a/src/corelib/text/qlocale.h b/src/corelib/text/qlocale.h
index 0a583b0881..7f1d47063b 100644
--- a/src/corelib/text/qlocale.h
+++ b/src/corelib/text/qlocale.h
@@ -938,7 +938,7 @@ public:
QLocale &operator=(const QLocale &other);
~QLocale();
- void swap(QLocale &other) noexcept { qSwap(d, other.d); }
+ void swap(QLocale &other) noexcept { d.swap(other.d); }
Language language() const;
Script script() const;
diff --git a/src/corelib/text/qstring.h b/src/corelib/text/qstring.h
index cdf710e5d9..e886f1182b 100644
--- a/src/corelib/text/qstring.h
+++ b/src/corelib/text/qstring.h
@@ -423,7 +423,7 @@ public:
inline QString(QString &&other) noexcept
{ qSwap(d, other.d); }
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QString)
- inline void swap(QString &other) noexcept { qSwap(d, other.d); }
+ void swap(QString &other) noexcept { d.swap(other.d); }
inline qsizetype size() const { return d.size; }
inline qsizetype count() const { return d.size; }
inline qsizetype length() const { return d.size; }
diff --git a/src/corelib/thread/qexception.h b/src/corelib/thread/qexception.h
index 1c69287615..4d4d53304e 100644
--- a/src/corelib/thread/qexception.h
+++ b/src/corelib/thread/qexception.h
@@ -72,7 +72,7 @@ public:
QUnhandledException(QUnhandledException &&other) noexcept;
QUnhandledException(const QUnhandledException &other) noexcept;
- void swap(QUnhandledException &other) noexcept { qSwap(d, other.d); }
+ void swap(QUnhandledException &other) noexcept { d.swap(other.d); }
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QUnhandledException)
QUnhandledException &operator=(const QUnhandledException &other) noexcept;
diff --git a/src/corelib/thread/qpromise.h b/src/corelib/thread/qpromise.h
index 3cecbd8306..a970f40d12 100644
--- a/src/corelib/thread/qpromise.h
+++ b/src/corelib/thread/qpromise.h
@@ -106,7 +106,7 @@ public:
void swap(QPromise<T> &other) noexcept
{
- qSwap(this->d, other.d);
+ d.swap(other.d);
}
#if defined(Q_CLANG_QDOC) // documentation-only simplified signatures
diff --git a/src/corelib/thread/qsemaphore.h b/src/corelib/thread/qsemaphore.h
index b57a274104..4e44965918 100644
--- a/src/corelib/thread/qsemaphore.h
+++ b/src/corelib/thread/qsemaphore.h
@@ -109,8 +109,8 @@ public:
void swap(QSemaphoreReleaser &other) noexcept
{
- qSwap(m_sem, other.m_sem);
- qSwap(m_n, other.m_n);
+ qt_ptr_swap(m_sem, other.m_sem);
+ std::swap(m_n, other.m_n);
}
QSemaphore *semaphore() const noexcept
diff --git a/src/corelib/tools/qarraydatapointer.h b/src/corelib/tools/qarraydatapointer.h
index dda3cf13eb..2759810919 100644
--- a/src/corelib/tools/qarraydatapointer.h
+++ b/src/corelib/tools/qarraydatapointer.h
@@ -149,9 +149,9 @@ public:
void swap(QArrayDataPointer &other) noexcept
{
- qSwap(d, other.d);
- qSwap(ptr, other.ptr);
- qSwap(size, other.size);
+ qt_ptr_swap(d, other.d);
+ qt_ptr_swap(ptr, other.ptr);
+ std::swap(size, other.size);
}
void clear() noexcept(std::is_nothrow_destructible<T>::value)
diff --git a/src/corelib/tools/qbitarray.h b/src/corelib/tools/qbitarray.h
index 75d680dc84..4466fbc9c0 100644
--- a/src/corelib/tools/qbitarray.h
+++ b/src/corelib/tools/qbitarray.h
@@ -62,7 +62,7 @@ public:
inline QBitArray(QBitArray &&other) noexcept : d(std::move(other.d)) {}
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QBitArray)
- inline void swap(QBitArray &other) noexcept { qSwap(d, other.d); }
+ void swap(QBitArray &other) noexcept { d.swap(other.d); }
inline qsizetype size() const { return (d.size() << 3) - *d.constData(); }
inline qsizetype count() const { return (d.size() << 3) - *d.constData(); }
diff --git a/src/corelib/tools/qcache.h b/src/corelib/tools/qcache.h
index 72a456890f..d5e978d6f3 100644
--- a/src/corelib/tools/qcache.h
+++ b/src/corelib/tools/qcache.h
@@ -64,8 +64,8 @@ class QCache
}
Value &operator=(Value &&other) noexcept
{
- qSwap(t, other.t);
- qSwap(cost, other.cost);
+ qt_ptr_swap(t, other.t);
+ std::swap(cost, other.cost);
return *this;
}
~Value() { delete t; }
diff --git a/src/corelib/tools/qcommandlineoption.h b/src/corelib/tools/qcommandlineoption.h
index 2e7d8fd9da..253c46a178 100644
--- a/src/corelib/tools/qcommandlineoption.h
+++ b/src/corelib/tools/qcommandlineoption.h
@@ -75,7 +75,7 @@ public:
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QCommandLineOption)
void swap(QCommandLineOption &other) noexcept
- { qSwap(d, other.d); }
+ { d.swap(other.d); }
QStringList names() const;
diff --git a/src/corelib/tools/qcontiguouscache.h b/src/corelib/tools/qcontiguouscache.h
index 62ebfa0658..e78a4d3184 100644
--- a/src/corelib/tools/qcontiguouscache.h
+++ b/src/corelib/tools/qcontiguouscache.h
@@ -97,7 +97,7 @@ public:
QContiguousCache<T> &operator=(const QContiguousCache<T> &other);
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QContiguousCache)
- inline void swap(QContiguousCache<T> &other) noexcept { qSwap(d, other.d); }
+ void swap(QContiguousCache &other) noexcept { qt_ptr_swap(d, other.d); }
#ifndef Q_CLANG_QDOC
template <typename U = T>
diff --git a/src/corelib/tools/qeasingcurve.h b/src/corelib/tools/qeasingcurve.h
index 7e50743bf1..225641d477 100644
--- a/src/corelib/tools/qeasingcurve.h
+++ b/src/corelib/tools/qeasingcurve.h
@@ -81,7 +81,7 @@ public:
QEasingCurve(QEasingCurve &&other) noexcept : d_ptr(other.d_ptr) { other.d_ptr = nullptr; }
QT_MOVE_ASSIGNMENT_OPERATOR_IMPL_VIA_PURE_SWAP(QEasingCurve)
- void swap(QEasingCurve &other) noexcept { qSwap(d_ptr, other.d_ptr); }
+ void swap(QEasingCurve &other) noexcept { qt_ptr_swap(d_ptr, other.d_ptr); }
bool operator==(const QEasingCurve &other) const;
inline bool operator!=(const QEasingCurve &other) const
diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h
index c4b4098c0f..a19713b337 100644
--- a/src/corelib/tools/qhash.h
+++ b/src/corelib/tools/qhash.h
@@ -911,7 +911,7 @@ public:
insert(f->first, f->second);
}
#endif
- void swap(QHash &other) noexcept { qSwap(d, other.d); }
+ void swap(QHash &other) noexcept { qt_ptr_swap(d, other.d); }
#ifndef Q_CLANG_QDOC
template <typename AKey = Key, typename AT = T>
@@ -1446,7 +1446,12 @@ public:
{
unite(std::move(other));
}
- void swap(QMultiHash &other) noexcept { qSwap(d, other.d); qSwap(m_size, other.m_size); }
+
+ void swap(QMultiHash &other) noexcept
+ {
+ qt_ptr_swap(d, other.d);
+ std::swap(m_size, other.m_size);
+ }
#ifndef Q_CLANG_QDOC
template <typename AKey = Key, typename AT = T>
diff --git a/src/corelib/tools/qlist.h b/src/corelib/tools/qlist.h
index aaa2a950dd..93498dfa69 100644
--- a/src/corelib/tools/qlist.h
+++ b/src/corelib/tools/qlist.h
@@ -351,7 +351,7 @@ public:
// compiler-generated special member functions are fine!
- void swap(QList<T> &other) noexcept { qSwap(d, other.d); }
+ void swap(QList &other) noexcept { d.swap(other.d); }
#ifndef Q_CLANG_QDOC
template <typename U = T>
diff --git a/src/corelib/tools/qmap.h b/src/corelib/tools/qmap.h
index f2f1bc96f4..5daf24189b 100644
--- a/src/corelib/tools/qmap.h
+++ b/src/corelib/tools/qmap.h
@@ -238,7 +238,7 @@ public:
void swap(QMap<Key, T> &other) noexcept
{
- qSwap(d, other.d);
+ d.swap(other.d);
}
QMap(std::initializer_list<std::pair<Key, T>> list)
@@ -849,7 +849,7 @@ public:
void swap(QMultiMap<Key, T> &other) noexcept
{
- qSwap(d, other.d);
+ d.swap(other.d);
}
explicit QMultiMap(const QMap<Key, T> &other)
diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h
index c9afb248a1..8c7ecae01a 100644
--- a/src/corelib/tools/qscopedpointer.h
+++ b/src/corelib/tools/qscopedpointer.h
@@ -173,7 +173,7 @@ public:
QT_DEPRECATED_VERSION_X_6_2("Use std::unique_ptr instead of QScopedPointer.")
void swap(QScopedPointer<T, Cleanup> &other) noexcept
{
- qSwap(d, other.d);
+ qt_ptr_swap(d, other.d);
}
#endif
diff --git a/src/corelib/tools/qshareddata.h b/src/corelib/tools/qshareddata.h
index de11257db3..717e33770e 100644
--- a/src/corelib/tools/qshareddata.h
+++ b/src/corelib/tools/qshareddata.h
@@ -125,7 +125,7 @@ public:
bool operator!() const noexcept { return d == nullptr; }
void swap(QSharedDataPointer &other) noexcept
- { qSwap(d, other.d); }
+ { qt_ptr_swap(d, other.d); }
#define DECLARE_COMPARE_SET(T1, A1, T2, A2) \
friend bool operator<(T1, T2) noexcept \
@@ -222,7 +222,7 @@ public:
bool operator!() const noexcept { return d == nullptr; }
void swap(QExplicitlySharedDataPointer &other) noexcept
- { qSwap(d, other.d); }
+ { qt_ptr_swap(d, other.d); }
DECLARE_COMPARE_SET(const QExplicitlySharedDataPointer &p1, p1.d, const QExplicitlySharedDataPointer &p2, p2.d)
DECLARE_COMPARE_SET(const QExplicitlySharedDataPointer &p1, p1.d, const T *ptr, ptr)
diff --git a/src/corelib/tools/qshareddata_impl.h b/src/corelib/tools/qshareddata_impl.h
index cf1c534cdf..960dbdecdc 100644
--- a/src/corelib/tools/qshareddata_impl.h
+++ b/src/corelib/tools/qshareddata_impl.h
@@ -138,7 +138,7 @@ public:
constexpr void swap(QExplicitlySharedDataPointerV2 &other) noexcept
{
- qSwap(d, other.d);
+ qt_ptr_swap(d, other.d);
}
// important change from QExplicitlySharedDataPointer: deep const
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index 61aeee4952..7b02ffe50a 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -508,8 +508,8 @@ private:
void internalSwap(QSharedPointer &other) noexcept
{
- qSwap(d, other.d);
- qSwap(this->value, other.value);
+ qt_ptr_swap(d, other.d);
+ qt_ptr_swap(this->value, other.value);
}
template <class X> friend class QSharedPointer;
@@ -538,8 +538,8 @@ private:
}
}
- qSwap(d, o);
- qSwap(this->value, actual);
+ qt_ptr_swap(d, o);
+ qt_ptr_swap(this->value, actual);
if (!d || d->strongref.loadRelaxed() == 0)
this->value = nullptr;
@@ -609,8 +609,8 @@ public:
void swap(QWeakPointer &other) noexcept
{
- qSwap(this->d, other.d);
- qSwap(this->value, other.value);
+ qt_ptr_swap(this->d, other.d);
+ qt_ptr_swap(this->value, other.value);
}
inline QWeakPointer(const QSharedPointer<T> &o) : d(o.d), value(o.data())
diff --git a/src/corelib/tools/qtaggedpointer.h b/src/corelib/tools/qtaggedpointer.h
index c12d5acdc2..68074cc43d 100644
--- a/src/corelib/tools/qtaggedpointer.h
+++ b/src/corelib/tools/qtaggedpointer.h
@@ -144,7 +144,7 @@ public:
void swap(QTaggedPointer &other) noexcept
{
- qSwap(d, other.d);
+ std::swap(d, other.d);
}
friend inline bool operator==(QTaggedPointer lhs, QTaggedPointer rhs) noexcept
diff --git a/src/corelib/tools/qversionnumber.h b/src/corelib/tools/qversionnumber.h
index 7b3e0995a0..8efdde3391 100644
--- a/src/corelib/tools/qversionnumber.h
+++ b/src/corelib/tools/qversionnumber.h
@@ -131,7 +131,7 @@ class QVersionNumber
void swap(SegmentStorage &other) noexcept
{
- qSwap(dummy, other.dummy);
+ std::swap(dummy, other.dummy);
}
explicit SegmentStorage(QList<int> &&seg)