From d823646db3e9f72569717dc656e5b2e4d3ce7709 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 29 Aug 2011 17:49:48 +0200 Subject: containers: add C++11-style c{begin,end}() as alias for const{Begin,End}() C++11 adds cbegin()/cend() functions for the same reason Qt has constBegin()/constEnd(). This patch adds these functions to the Qt containers with the same implementation as constBegin()/constEnd(). It also fixes the return types in the documentation of existing constFind() functions (documentation only). C++11 only adds cbegin()/cend() (and crbegin()/crend(), which Qt doesn't have). In particular, it doesn't add cfind(), so I didn't supply these, even though Qt comes with constFind(). This is a forward-port of https://qt.gitorious.org/qt/qt/merge_requests/1365. Change-Id: Ida086b64246b24e25254eafbcb06c8e33388502b Reviewed-by: Olivier Goffart --- src/corelib/tools/qhash.cpp | 20 +++++++++++++++++++- 1 file changed, 19 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 d5703e8b2a..62fc6c5d86 100644 --- a/src/corelib/tools/qhash.cpp +++ b/src/corelib/tools/qhash.cpp @@ -1045,6 +1045,15 @@ void QHashData::checkSanity() \overload */ +/*! \fn QHash::const_iterator QHash::cbegin() const + \since 5.0 + + Returns a const \l{STL-style iterator} pointing to the first item + in the hash. + + \sa begin(), cend() +*/ + /*! \fn QHash::const_iterator QHash::constBegin() const Returns a const \l{STL-style iterator} pointing to the first item @@ -1074,6 +1083,15 @@ void QHashData::checkSanity() \sa constBegin(), end() */ +/*! \fn QHash::const_iterator QHash::cend() const + \since 5.0 + + Returns a const \l{STL-style iterator} pointing to the imaginary + item after the last item in the hash. + + \sa cbegin(), end() +*/ + /*! \fn QHash::iterator QHash::erase(iterator pos) Removes the (key, value) pair associated with the iterator \a pos @@ -1114,7 +1132,7 @@ void QHashData::checkSanity() \overload */ -/*! \fn QHash::iterator QHash::constFind(const Key &key) const +/*! \fn QHash::const_iterator QHash::constFind(const Key &key) const \since 4.1 Returns an iterator pointing to the item with the \a key in the -- cgit v1.2.3