diff options
author | Harald Fernengel <harald@trolltech.com> | 2009-08-10 16:16:16 (GMT) |
---|---|---|
committer | Harald Fernengel <harald@trolltech.com> | 2009-08-10 16:16:16 (GMT) |
commit | 975b75bcda1570adc2aa0d0327c5445b25da1515 (patch) | |
tree | 3723f824a33a2a8a7de83b5d4c0d84ce49b00870 /src/corelib/tools | |
parent | 361e40191a82b69fe7549215bd27db94c05fc083 (diff) | |
download | Qt-975b75bcda1570adc2aa0d0327c5445b25da1515.zip Qt-975b75bcda1570adc2aa0d0327c5445b25da1515.tar.gz Qt-975b75bcda1570adc2aa0d0327c5445b25da1515.tar.bz2 |
Add comparison operators also to subclasses
Compiler would for some reason choose operator bool()
instead when comparing subclasses of QScopedPointer.
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qscopedpointer.h | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h index 769ad10..344964b 100644 --- a/src/corelib/tools/qscopedpointer.h +++ b/src/corelib/tools/qscopedpointer.h @@ -113,12 +113,12 @@ public: return d; } - inline bool operator==(const QScopedPointer<T> &other) const + inline bool operator==(const QScopedPointer<T, Cleanup> &other) const { return d == other.d; } - inline bool operator!=(const QScopedPointer<T> &other) const + inline bool operator!=(const QScopedPointer<T, Cleanup> &other) const { return d != other.d; } @@ -194,6 +194,16 @@ public: return this->d[i]; } + inline bool operator==(const QScopedArrayPointer<T, Cleanup> &other) const + { + return this->d == other.d; + } + + inline bool operator!=(const QScopedArrayPointer<T, Cleanup> &other) const + { + return this->d != other.d; + } + private: Q_DISABLE_COPY(QScopedArrayPointer) }; @@ -214,6 +224,16 @@ public: return this->d; } + inline bool operator==(const QCustomScopedPointer<T, Cleanup> &other) const + { + return this->d == other.d; + } + + inline bool operator!=(const QCustomScopedPointer<T, Cleanup> &other) const + { + return this->d != other.d; + } + private: Q_DISABLE_COPY(QCustomScopedPointer) }; @@ -258,6 +278,16 @@ public: QScopedPointerSharedDeleter<T>::cleanup(oldD); } + inline bool operator==(const QScopedSharedPointer<T> &other) const + { + return this->d == other.d; + } + + inline bool operator!=(const QScopedSharedPointer<T> &other) const + { + return this->d != other.d; + } + private: Q_DISABLE_COPY(QScopedSharedPointer) }; |