summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qlinkedlist.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-03-31 00:14:24 +0200
committerMarc Mutz <marc.mutz@kdab.com>2015-10-13 18:07:20 +0000
commit967e4f258cd39991fd2d0ac3753544900d51fbc2 (patch)
tree6a2ef53300750c0efcf8ce16332522fe2bbed8c3 /src/corelib/tools/qlinkedlist.cpp
parent0df5d079290b4c3b13e58e9397fabdc1dfdba96b (diff)
QLinkedList/QSet: add {const_,}reverse_iterator, {c,}r{begin,end}()
Now all Qt sequential containers consistently provide reverse iterators. The associative ones, by way of not returning std::pair from op*, can't just use std::reverse_iterator. They would miss .key() and .value() methods. So that has to wait for 5.7. The reverse versions of the new key_iterators can also just use std::reverse_iterator, but I'm afraid that after bikeshedding over keyRBegin() vs. rKeyBegin() vs. reverseKeyBegin() vs. rkbegin() vs. krbegin() (<-- of course, what else?), it would anyway be too late for 5.6, so defer, too. [ChangeLog][QtCore][QLinkedList/QSet] Added rbegin(), crbegin(), rend(), crend(), and reverse_iterator and const_reverse_iterator typedefs. Task-number: QTBUG-25919 Change-Id: I58316fffade469e9a42c61d7aa1455ae3443fd94 Reviewed-by: Sérgio Martins <sergio.martins@kdab.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/corelib/tools/qlinkedlist.cpp')
-rw-r--r--src/corelib/tools/qlinkedlist.cpp78
1 files changed, 78 insertions, 0 deletions
diff --git a/src/corelib/tools/qlinkedlist.cpp b/src/corelib/tools/qlinkedlist.cpp
index fbd263e88b..5d91bfe924 100644
--- a/src/corelib/tools/qlinkedlist.cpp
+++ b/src/corelib/tools/qlinkedlist.cpp
@@ -388,6 +388,52 @@ const QLinkedListData QLinkedListData::shared_null = {
\sa constBegin(), end()
*/
+/*! \fn QLinkedList::reverse_iterator QLinkedList::rbegin()
+ \since 5.6
+
+ Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to the first
+ item in the list, in reverse order.
+
+ \sa begin(), crbegin(), rend()
+*/
+
+/*! \fn QLinkedList::const_reverse_iterator QLinkedList::rbegin() const
+ \since 5.6
+ \overload
+*/
+
+/*! \fn QLinkedList::const_reverse_iterator QLinkedList::crbegin() const
+ \since 5.6
+
+ Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to the first
+ item in the list, in reverse order.
+
+ \sa begin(), rbegin(), rend()
+*/
+
+/*! \fn QLinkedList::reverse_iterator QLinkedList::rend()
+ \since 5.6
+
+ Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to one past
+ the last item in the list, in reverse order.
+
+ \sa end(), crend(), rbegin()
+*/
+
+/*! \fn QLinkedList::const_reverse_iterator QLinkedList::rend() const
+ \since 5.6
+ \overload
+*/
+
+/*! \fn QLinkedList::const_reverse_iterator QLinkedList::crend() const
+ \since 5.6
+
+ Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to one
+ past the last item in the list, in reverse order.
+
+ \sa end(), rend(), rbegin()
+*/
+
/*! \fn QLinkedList::iterator QLinkedList::insert(iterator before, const T &value)
Inserts \a value in front of the item pointed to by the iterator
@@ -423,6 +469,38 @@ const QLinkedListData QLinkedListData::shared_null = {
Qt-style synonym for QLinkedList::const_iterator.
*/
+/*! \typedef QLinkedList::reverse_iterator
+ \since 5.6
+
+ The QLinkedList::reverse_iterator typedef provides an STL-style non-const
+ reverse iterator for QLinkedList.
+
+ It is simply a typedef for \c{std::reverse_iterator<QLinkedList::iterator>}.
+
+ \warning Iterators on implicitly shared containers do not work
+ exactly like STL-iterators. You should avoid copying a container
+ while iterators are active on that container. For more information,
+ read \l{Implicit sharing iterator problem}.
+
+ \sa QLinkedList::rbegin(), QLinkedList::rend(), QLinkedList::const_reverse_iterator, QLinkedList::iterator
+*/
+
+/*! \typedef QLinkedList::const_reverse_iterator
+ \since 5.6
+
+ The QLinkedList::const_reverse_iterator typedef provides an STL-style const
+ reverse iterator for QLinkedList.
+
+ It is simply a typedef for \c{std::reverse_iterator<QLinkedList::const_iterator>}.
+
+ \warning Iterators on implicitly shared containers do not work
+ exactly like STL-iterators. You should avoid copying a container
+ while iterators are active on that container. For more information,
+ read \l{Implicit sharing iterator problem}.
+
+ \sa QLinkedList::rbegin(), QLinkedList::rend(), QLinkedList::reverse_iterator, QLinkedList::const_iterator
+*/
+
/*!
\typedef QLinkedList::size_type