diff options
Diffstat (limited to 'src/corelib/tools/qscopedpointer.h')
-rw-r--r-- | src/corelib/tools/qscopedpointer.h | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h index d98b914757..3e6af97a33 100644 --- a/src/corelib/tools/qscopedpointer.h +++ b/src/corelib/tools/qscopedpointer.h @@ -162,7 +162,7 @@ public: return oldD; } - inline void swap(QScopedPointer<T, Cleanup> &other) + void swap(QScopedPointer<T, Cleanup> &other) Q_DECL_NOTHROW { qSwap(d, other.d); } @@ -189,18 +189,9 @@ inline bool operator!=(const QScopedPointer<T, Cleanup> &lhs, const QScopedPoint } template <class T, class Cleanup> -Q_INLINE_TEMPLATE void qSwap(QScopedPointer<T, Cleanup> &p1, QScopedPointer<T, Cleanup> &p2) +inline void swap(QScopedPointer<T, Cleanup> &p1, QScopedPointer<T, Cleanup> &p2) Q_DECL_NOTHROW { p1.swap(p2); } -QT_END_NAMESPACE -namespace std { - template <class T, class Cleanup> - Q_INLINE_TEMPLATE void swap(QT_PREPEND_NAMESPACE(QScopedPointer)<T, Cleanup> &p1, QT_PREPEND_NAMESPACE(QScopedPointer)<T, Cleanup> &p2) - { p1.swap(p2); } -} -QT_BEGIN_NAMESPACE - - namespace QtPrivate { template <typename X, typename Y> struct QScopedArrayEnsureSameType; @@ -230,6 +221,9 @@ public: return this->d[i]; } + void swap(QScopedArrayPointer &other) Q_DECL_NOTHROW // prevent QScopedPointer <->QScopedArrayPointer swaps + { QScopedPointer<T, Cleanup>::swap(other); } + private: explicit inline QScopedArrayPointer(void *) { // Enforce the same type. @@ -245,6 +239,10 @@ private: Q_DISABLE_COPY(QScopedArrayPointer) }; +template <typename T, typename Cleanup> +inline void swap(QScopedArrayPointer<T, Cleanup> &lhs, QScopedArrayPointer<T, Cleanup> &rhs) Q_DECL_NOTHROW +{ lhs.swap(rhs); } + QT_END_NAMESPACE #endif // QSCOPEDPOINTER_H |