QList: have operator= defer to copy-ctor and swap
Change-Id: I0f9bdbc444abfaea35278281b6c1dff4b52c526f Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
This commit is contained in:
parent
737c0a3717
commit
2b70a7d25c
@ -419,13 +419,8 @@ template <typename T>
|
||||
Q_INLINE_TEMPLATE QList<T> &QList<T>::operator=(const QList<T> &l)
|
||||
{
|
||||
if (d != l.d) {
|
||||
QListData::Data *o = l.d;
|
||||
o->ref.ref();
|
||||
if (!d->ref.deref())
|
||||
dealloc(d);
|
||||
d = o;
|
||||
if (!d->sharable)
|
||||
detach_helper();
|
||||
QList<T> tmp(l);
|
||||
tmp.swap(*this);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user