From a1e62e7ba14b00ac7c361936a18e7bc42bf1286d Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 2 Apr 2019 10:54:54 +0200 Subject: Replace Q_DECL_NOEXCEPT with noexcept in corelib In preparation of Qt6 move away from pre-C++11 macros. Change-Id: I44126693c20c18eca5620caab4f7e746218e0ce3 Reviewed-by: Thiago Macieira --- src/corelib/tools/qscopedpointer.h | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/corelib/tools/qscopedpointer.h') diff --git a/src/corelib/tools/qscopedpointer.h b/src/corelib/tools/qscopedpointer.h index 2a4083466b..756e0aec79 100644 --- a/src/corelib/tools/qscopedpointer.h +++ b/src/corelib/tools/qscopedpointer.h @@ -97,7 +97,7 @@ class QScopedPointer { typedef T *QScopedPointer:: *RestrictedBool; public: - explicit QScopedPointer(T *p = nullptr) Q_DECL_NOTHROW : d(p) + explicit QScopedPointer(T *p = nullptr) noexcept : d(p) { } @@ -113,12 +113,12 @@ public: return *d; } - T *operator->() const Q_DECL_NOTHROW + T *operator->() const noexcept { return d; } - bool operator!() const Q_DECL_NOTHROW + bool operator!() const noexcept { return !d; } @@ -129,23 +129,23 @@ public: return isNull() ? nullptr : &QScopedPointer::d; } #else - operator RestrictedBool() const Q_DECL_NOTHROW + operator RestrictedBool() const noexcept { return isNull() ? nullptr : &QScopedPointer::d; } #endif - T *data() const Q_DECL_NOTHROW + T *data() const noexcept { return d; } - T *get() const Q_DECL_NOTHROW + T *get() const noexcept { return d; } - bool isNull() const Q_DECL_NOTHROW + bool isNull() const noexcept { return !d; } @@ -159,14 +159,14 @@ public: Cleanup::cleanup(oldD); } - T *take() Q_DECL_NOTHROW + T *take() noexcept { T *oldD = d; d = nullptr; return oldD; } - void swap(QScopedPointer &other) Q_DECL_NOTHROW + void swap(QScopedPointer &other) noexcept { qSwap(d, other.d); } @@ -181,43 +181,43 @@ private: }; template -inline bool operator==(const QScopedPointer &lhs, const QScopedPointer &rhs) Q_DECL_NOTHROW +inline bool operator==(const QScopedPointer &lhs, const QScopedPointer &rhs) noexcept { return lhs.data() == rhs.data(); } template -inline bool operator!=(const QScopedPointer &lhs, const QScopedPointer &rhs) Q_DECL_NOTHROW +inline bool operator!=(const QScopedPointer &lhs, const QScopedPointer &rhs) noexcept { return lhs.data() != rhs.data(); } template -inline bool operator==(const QScopedPointer &lhs, std::nullptr_t) Q_DECL_NOTHROW +inline bool operator==(const QScopedPointer &lhs, std::nullptr_t) noexcept { return lhs.isNull(); } template -inline bool operator==(std::nullptr_t, const QScopedPointer &rhs) Q_DECL_NOTHROW +inline bool operator==(std::nullptr_t, const QScopedPointer &rhs) noexcept { return rhs.isNull(); } template -inline bool operator!=(const QScopedPointer &lhs, std::nullptr_t) Q_DECL_NOTHROW +inline bool operator!=(const QScopedPointer &lhs, std::nullptr_t) noexcept { return !lhs.isNull(); } template -inline bool operator!=(std::nullptr_t, const QScopedPointer &rhs) Q_DECL_NOTHROW +inline bool operator!=(std::nullptr_t, const QScopedPointer &rhs) noexcept { return !rhs.isNull(); } template -inline void swap(QScopedPointer &p1, QScopedPointer &p2) Q_DECL_NOTHROW +inline void swap(QScopedPointer &p1, QScopedPointer &p2) noexcept { p1.swap(p2); } template > @@ -244,7 +244,7 @@ public: return this->d[i]; } - void swap(QScopedArrayPointer &other) Q_DECL_NOTHROW // prevent QScopedPointer <->QScopedArrayPointer swaps + void swap(QScopedArrayPointer &other) noexcept // prevent QScopedPointer <->QScopedArrayPointer swaps { QScopedPointer::swap(other); } private: @@ -263,7 +263,7 @@ private: }; template -inline void swap(QScopedArrayPointer &lhs, QScopedArrayPointer &rhs) Q_DECL_NOTHROW +inline void swap(QScopedArrayPointer &lhs, QScopedArrayPointer &rhs) noexcept { lhs.swap(rhs); } QT_END_NAMESPACE -- cgit v1.2.3