diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2015-06-27 13:51:27 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2015-09-13 12:23:11 +0000 |
commit | 39a472430fb60b5020c94242f6bc071172772e01 (patch) | |
tree | efae6132c449ccd8ba585b29c387cfcac17f1622 /src/corelib/tools/qsharedpointer_impl.h | |
parent | 78dd962f68cd00d2efc4b682a70ed1885915a979 (diff) |
QWeakPointer: mark as nothrow {default,copy} {constructible,assignable}
Change-Id: I6757a775c72f15c210004dc25d962ec5d3b88012
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.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index c14999996c..c23193c51a 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -597,7 +597,7 @@ public: inline bool operator !() const { return isNull(); } inline T *data() const { return d == Q_NULLPTR || d->strongref.load() == 0 ? Q_NULLPTR : value; } - inline QWeakPointer() : d(Q_NULLPTR), value(Q_NULLPTR) { } + inline QWeakPointer() Q_DECL_NOTHROW : d(Q_NULLPTR), value(Q_NULLPTR) { } inline ~QWeakPointer() { if (d && !d->weakref.deref()) delete d; } #ifndef QT_NO_QOBJECT @@ -615,15 +615,16 @@ public: { return *this = QWeakPointer(ptr); } #endif - inline QWeakPointer(const QWeakPointer &o) : d(o.d), value(o.value) + QWeakPointer(const QWeakPointer &other) Q_DECL_NOTHROW : d(other.d), value(other.value) { if (d) d->weakref.ref(); } - inline QWeakPointer &operator=(const QWeakPointer &o) + QWeakPointer &operator=(const QWeakPointer &other) Q_DECL_NOTHROW { - internalSet(o.d, o.value); + QWeakPointer copy(other); + swap(copy); return *this; } - inline void swap(QWeakPointer &other) + void swap(QWeakPointer &other) Q_DECL_NOTHROW { qSwap(this->d, other.d); qSwap(this->value, other.value); |