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>
This commit is contained in:
parent
2978163759
commit
852b1d7b9b
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user