From 98d7d4c1e51010a0ca48ff59f30342e81fd0d066 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Sat, 22 Feb 2014 23:54:31 +0100 Subject: [PATCH] QSharedPointer/QWeakPointer: clean up class definition Remove superfluous class template arguments (). Qualify one member function call with this-> instead of QSharedPointer::. Change-Id: I5cbe8776fc914138b7ceb4747a08c6475227197b Reviewed-by: Olivier Goffart Reviewed-by: Thiago Macieira --- src/corelib/tools/qsharedpointer_impl.h | 30 ++++++++++++------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/corelib/tools/qsharedpointer_impl.h b/src/corelib/tools/qsharedpointer_impl.h index e7b23157db..c077b84492 100644 --- a/src/corelib/tools/qsharedpointer_impl.h +++ b/src/corelib/tools/qsharedpointer_impl.h @@ -318,9 +318,9 @@ public: inline QSharedPointer(T *ptr, Deleter deleter) : value(ptr) // throws { internalConstruct(ptr, deleter); } - inline QSharedPointer(const QSharedPointer &other) : value(other.value), d(other.d) + inline QSharedPointer(const QSharedPointer &other) : value(other.value), d(other.d) { if (d) ref(); } - inline QSharedPointer &operator=(const QSharedPointer &other) + inline QSharedPointer &operator=(const QSharedPointer &other) { QSharedPointer copy(other); swap(copy); @@ -333,7 +333,7 @@ public: other.d = 0; other.value = 0; } - inline QSharedPointer &operator=(QSharedPointer &&other) + inline QSharedPointer &operator=(QSharedPointer &&other) { swap(other); return *this; @@ -345,7 +345,7 @@ public: { if (d) ref(); } template - inline QSharedPointer &operator=(const QSharedPointer &other) + inline QSharedPointer &operator=(const QSharedPointer &other) { QSHAREDPOINTER_VERIFY_AUTO_CAST(T, X); // if you get an error in this line, the cast is invalid internalCopy(other); @@ -361,7 +361,7 @@ public: { internalSet(other.d, other.value); return *this; } inline void swap(QSharedPointer &other) - { QSharedPointer::internalSwap(other); } + { this->internalSwap(other); } inline void reset() { clear(); } inline void reset(T *t) @@ -402,7 +402,7 @@ public: #if defined(Q_COMPILER_RVALUE_REFS) && defined(Q_COMPILER_VARIADIC_TEMPLATES) template - static QSharedPointer create(Args && ...arguments) + static QSharedPointer create(Args && ...arguments) { typedef QtSharedPointer::ExternalRefCountWithContiguousData Private; # ifdef QT_SHAREDPOINTER_TRACK_POINTERS @@ -410,7 +410,7 @@ public: # else typename Private::DestroyerFn destroy = &Private::deleter; # endif - QSharedPointer result(Qt::Uninitialized); + QSharedPointer result(Qt::Uninitialized); result.d = Private::create(&result.value, destroy); // now initialize the data @@ -422,7 +422,7 @@ public: return result; } #else - static inline QSharedPointer create() + static inline QSharedPointer create() { typedef QtSharedPointer::ExternalRefCountWithContiguousData Private; # ifdef QT_SHAREDPOINTER_TRACK_POINTERS @@ -430,7 +430,7 @@ public: # else typename Private::DestroyerFn destroy = &Private::deleter; # endif - QSharedPointer result(Qt::Uninitialized); + QSharedPointer result(Qt::Uninitialized); result.d = Private::create(&result.value, destroy); // now initialize the data @@ -579,9 +579,9 @@ public: { return *this = QWeakPointer(ptr); } #endif - inline QWeakPointer(const QWeakPointer &o) : d(o.d), value(o.value) + inline QWeakPointer(const QWeakPointer &o) : d(o.d), value(o.value) { if (d) d->weakref.ref(); } - inline QWeakPointer &operator=(const QWeakPointer &o) + inline QWeakPointer &operator=(const QWeakPointer &o) { internalSet(o.d, o.value); return *this; @@ -589,7 +589,7 @@ public: inline QWeakPointer(const QSharedPointer &o) : d(o.d), value(o.data()) { if (d) d->weakref.ref();} - inline QWeakPointer &operator=(const QSharedPointer &o) + inline QWeakPointer &operator=(const QSharedPointer &o) { internalSet(o.d, o.value); return *this; @@ -600,7 +600,7 @@ public: { *this = o; } template - inline QWeakPointer &operator=(const QWeakPointer &o) + inline QWeakPointer &operator=(const QWeakPointer &o) { // conversion between X and T could require access to the virtual table // so force the operation to go through QSharedPointer @@ -621,7 +621,7 @@ public: { *this = o; } template - inline QWeakPointer &operator=(const QSharedPointer &o) + inline QWeakPointer &operator=(const QSharedPointer &o) { QSHAREDPOINTER_VERIFY_AUTO_CAST(T, X); // if you get an error in this line, the cast is invalid internalSet(o.d, o.data()); @@ -636,7 +636,7 @@ public: inline bool operator!=(const QSharedPointer &o) const { return !(*this == o); } - inline void clear() { *this = QWeakPointer(); } + inline void clear() { *this = QWeakPointer(); } inline QSharedPointer toStrongRef() const { return QSharedPointer(*this); }