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/qhash.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/corelib/tools/qhash.h') diff --git a/src/corelib/tools/qhash.h b/src/corelib/tools/qhash.h index a586ca5671..9a733180a5 100644 --- a/src/corelib/tools/qhash.h +++ b/src/corelib/tools/qhash.h @@ -240,7 +240,7 @@ class QHash static inline int alignOfNode() { return qMax(sizeof(void*), Q_ALIGNOF(Node)); } public: - inline QHash() Q_DECL_NOTHROW : d(const_cast(&QHashData::shared_null)) { } + inline QHash() noexcept : d(const_cast(&QHashData::shared_null)) { } #ifdef Q_COMPILER_INITIALIZER_LISTS inline QHash(std::initializer_list > list) : d(const_cast(&QHashData::shared_null)) @@ -255,11 +255,11 @@ public: QHash &operator=(const QHash &other); #ifdef Q_COMPILER_RVALUE_REFS - QHash(QHash &&other) Q_DECL_NOTHROW : d(other.d) { other.d = const_cast(&QHashData::shared_null); } - QHash &operator=(QHash &&other) Q_DECL_NOTHROW + QHash(QHash &&other) noexcept : d(other.d) { other.d = const_cast(&QHashData::shared_null); } + QHash &operator=(QHash &&other) noexcept { QHash moved(std::move(other)); swap(moved); return *this; } #endif - void swap(QHash &other) Q_DECL_NOTHROW { qSwap(d, other.d); } + void swap(QHash &other) noexcept { qSwap(d, other.d); } bool operator==(const QHash &other) const; bool operator!=(const QHash &other) const { return !(*this == other); } @@ -473,7 +473,7 @@ public: inline const_key_value_iterator constKeyValueEnd() const { return const_key_value_iterator(end()); } QPair equal_range(const Key &key); - QPair equal_range(const Key &key) const Q_DECL_NOTHROW; + QPair equal_range(const Key &key) const noexcept; iterator erase(iterator it) { return erase(const_iterator(it.i)); } iterator erase(const_iterator it); @@ -512,11 +512,11 @@ private: static void duplicateNode(QHashData::Node *originalNode, void *newNode); - bool isValidIterator(const iterator &it) const Q_DECL_NOTHROW + bool isValidIterator(const iterator &it) const noexcept { return isValidNode(it.i); } - bool isValidIterator(const const_iterator &it) const Q_DECL_NOTHROW + bool isValidIterator(const const_iterator &it) const noexcept { return isValidNode(it.i); } - bool isValidNode(QHashData::Node *node) const Q_DECL_NOTHROW + bool isValidNode(QHashData::Node *node) const noexcept { #if defined(QT_DEBUG) && !defined(Q_HASH_NO_ITERATOR_DEBUG) while (node->next) @@ -993,7 +993,7 @@ QPair::iterator, typename QHash::iterator> QHash< } template -QPair::const_iterator, typename QHash::const_iterator> QHash::equal_range(const Key &akey) const Q_DECL_NOTHROW +QPair::const_iterator, typename QHash::const_iterator> QHash::equal_range(const Key &akey) const noexcept { Node *node = *findNode(akey); const_iterator firstIt = const_iterator(node); @@ -1020,7 +1020,7 @@ template class QMultiHash : public QHash { public: - QMultiHash() Q_DECL_NOTHROW {} + QMultiHash() noexcept {} #ifdef Q_COMPILER_INITIALIZER_LISTS inline QMultiHash(std::initializer_list > list) { @@ -1034,9 +1034,9 @@ public: QMultiHash(const QHash &other) : QHash(other) {} #ifdef Q_COMPILER_RVALUE_REFS - QMultiHash(QHash &&other) Q_DECL_NOTHROW : QHash(std::move(other)) {} + QMultiHash(QHash &&other) noexcept : QHash(std::move(other)) {} #endif - void swap(QMultiHash &other) Q_DECL_NOTHROW { QHash::swap(other); } // prevent QMultiHash<->QHash swaps + void swap(QMultiHash &other) noexcept { QHash::swap(other); } // prevent QMultiHash<->QHash swaps inline typename QHash::iterator replace(const Key &key, const T &value) { return QHash::insert(key, value); } -- cgit v1.2.3