summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qsharedpointer_impl.h
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-06-27 13:40:05 +0200
committerMarc Mutz <marc.mutz@kdab.com>2015-07-21 21:10:43 +0000
commit852b1d7b9bcacdb5ce28fab6fba94ec119adda5d (patch)
tree2880f288d37abfb424aadd09f15e78e776d91f59 /src/corelib/tools/qsharedpointer_impl.h
parent297816375937de46aec5e53963c6332190ed373e (diff)
QSharedPointer: make copy assignment from compatible shared pointer use copy-swap
... like all other assignment operators. Removes the last user of internalCopy(). Removed. Change-Id: I15f2cb3b7b26988dd3bc2f4475bc316480476993 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qsharedpointer_impl.h')
-rw-r--r--src/corelib/tools/qsharedpointer_impl.h16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h
index b1434b530e..1323dd6b1c 100644
--- a/src/corelib/tools/qsharedpointer_impl.h
+++ b/src/corelib/tools/qsharedpointer_impl.h
@@ -362,8 +362,8 @@ public:
template <class X>
inline QSharedPointer &operator=(const QSharedPointer<X> &other)
{
- QSHAREDPOINTER_VERIFY_AUTO_CAST(T, X); // if you get an error in this line, the cast is invalid
- internalCopy(other);
+ QSharedPointer copy(other);
+ swap(copy);
return *this;
}
@@ -527,18 +527,6 @@ private:
enableSharedFromThis(ptr);
}
- template <class X>
- inline void internalCopy(const QSharedPointer<X> &other)
- {
- Data *o = other.d;
- T *actual = other.value;
- if (o)
- other.ref();
- qSwap(d, o);
- qSwap(this->value, actual);
- deref(o);
- }
-
void internalSwap(QSharedPointer &other) Q_DECL_NOTHROW
{
qSwap(d, other.d);