From 0f923a8ce45a0b9379bf0a43e68897a3a8333fda Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 3 Dec 2015 12:56:56 +0100 Subject: QHash/QSet: add erase(const_iterator) This is the signature the functions have in C++11. For the std containers, this is just convenience, but for Qt containers with their implicit sharing problem, the combination of erase() with constFind() can delay a detach until absolutely necessary. [ChangeLog][QtCore][QHash/QSet] Added erase(const_iterator). Change-Id: I2fc841c664cd7515b0f56fd7210fcd17c37f9014 Reviewed-by: David Faure --- src/corelib/tools/qhash.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/corelib/tools/qhash.cpp') diff --git a/src/corelib/tools/qhash.cpp b/src/corelib/tools/qhash.cpp index 7724516a5d..75f1e6a1bc 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -1632,7 +1632,8 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW \sa keyBegin() */ -/*! \fn QHash::iterator QHash::erase(iterator pos) +/*! \fn QHash::iterator QHash::erase(const_iterator pos) + \since 5.7 Removes the (key, value) pair associated with the iterator \a pos from the hash, and returns an iterator to the next item in the @@ -1648,6 +1649,10 @@ uint qHash(long double key, uint seed) Q_DECL_NOTHROW \sa remove(), take(), find() */ +/*! \fn QHash::iterator QHash::erase(iterator pos) + \overload +*/ + /*! \fn QHash::iterator QHash::find(const Key &key) Returns an iterator pointing to the item with the \a key in the -- cgit v1.2.3