diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2019-08-02 22:27:45 +0300 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2019-08-03 07:09:30 +0300 |
commit | 2ab3af564c7c8424b558c5902614d1a410850acf (patch) | |
tree | bda078c105587bfd0d980f0a4c865d81c4ff7a9d /src/corelib/tools | |
parent | 05251bca1dc5aabdd1e4548a1bf1bf757f615791 (diff) |
Thou Shalt Not Specialize std Function Templates
(or forward-declare std types)
(with apologies to Mr Walter Brown)
This applies the changes to our other smart pointers that
a0c4b6f34546bdd22167a76a0540d37e9a37c0cf applied to QSharedPointer,
with the same rationale: wg21.link/p0551.
It also fixes a fwd declaration of std::function, including
<functional> instead. Rationale: wg21.link/p684r0.
Change-Id: If275af91f6eac15eb418b200ac7d08ba084a6130
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qarraydatapointer.h | 13 | ||||
-rw-r--r-- | src/corelib/tools/qshareddata.h | 16 |
2 files changed, 3 insertions, 26 deletions
diff --git a/src/corelib/tools/qarraydatapointer.h b/src/corelib/tools/qarraydatapointer.h index 0322615f91..af5173c9ad 100644 --- a/src/corelib/tools/qarraydatapointer.h +++ b/src/corelib/tools/qarraydatapointer.h @@ -202,22 +202,11 @@ inline bool operator!=(const QArrayDataPointer<T> &lhs, const QArrayDataPointer< } template <class T> -inline void qSwap(QArrayDataPointer<T> &p1, QArrayDataPointer<T> &p2) +inline void swap(QArrayDataPointer<T> &p1, QArrayDataPointer<T> &p2) { p1.swap(p2); } QT_END_NAMESPACE -namespace std -{ - template <class T> - inline void swap( - QT_PREPEND_NAMESPACE(QArrayDataPointer)<T> &p1, - QT_PREPEND_NAMESPACE(QArrayDataPointer)<T> &p2) - { - p1.swap(p2); - } -} - #endif // include guard diff --git a/src/corelib/tools/qshareddata.h b/src/corelib/tools/qshareddata.h index ab54c76720..f123f8e7b9 100644 --- a/src/corelib/tools/qshareddata.h +++ b/src/corelib/tools/qshareddata.h @@ -297,25 +297,13 @@ template <class T> inline bool operator==(const QExplicitlySharedDataPointer<T> } template <class T> -Q_INLINE_TEMPLATE void qSwap(QSharedDataPointer<T> &p1, QSharedDataPointer<T> &p2) +Q_INLINE_TEMPLATE void swap(QSharedDataPointer<T> &p1, QSharedDataPointer<T> &p2) { p1.swap(p2); } template <class T> -Q_INLINE_TEMPLATE void qSwap(QExplicitlySharedDataPointer<T> &p1, QExplicitlySharedDataPointer<T> &p2) +Q_INLINE_TEMPLATE void swap(QExplicitlySharedDataPointer<T> &p1, QExplicitlySharedDataPointer<T> &p2) { p1.swap(p2); } -QT_END_NAMESPACE -namespace std { - template <class T> - Q_INLINE_TEMPLATE void swap(QT_PREPEND_NAMESPACE(QSharedDataPointer)<T> &p1, QT_PREPEND_NAMESPACE(QSharedDataPointer)<T> &p2) - { p1.swap(p2); } - - template <class T> - Q_INLINE_TEMPLATE void swap(QT_PREPEND_NAMESPACE(QExplicitlySharedDataPointer)<T> &p1, QT_PREPEND_NAMESPACE(QExplicitlySharedDataPointer)<T> &p2) - { p1.swap(p2); } -} -QT_BEGIN_NAMESPACE - template <class T> Q_INLINE_TEMPLATE uint qHash(const QSharedDataPointer<T> &ptr, uint seed = 0) noexcept { |