summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
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-04-05 16:57:49 +0000
commitcc164f9ac73cd44a0ab082af78dccde8057154dc (patch)
treeb7cadf79e0b274534fbdb728fcc128b6f7c9391b /src/corelib/tools
parentf276dd5b7f8b45201949906c3167ff43ecb2caf4 (diff)
QVarLengthArray: add {const_,reverse_iterator}, {c,}r{begin,end}()
[ChangeLog][QtCore][QVarLengthArray] Added rbegin(), crbegin(), rend(), crend(), and reverse_iterator and const_reverse_iterator typedefs. Task-number: QTBUG-25919 Change-Id: Ifda5d420802a3594c3181f54036279f16a7da16e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools')
-rw-r--r--src/corelib/tools/qvarlengtharray.h9
-rw-r--r--src/corelib/tools/qvarlengtharray.qdoc60
2 files changed, 69 insertions, 0 deletions
diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h
index 2d8f922cb8..2933e40549 100644
--- a/src/corelib/tools/qvarlengtharray.h
+++ b/src/corelib/tools/qvarlengtharray.h
@@ -45,6 +45,7 @@
#ifdef Q_COMPILER_INITIALIZER_LISTS
#include <initializer_list>
#endif
+#include <iterator>
QT_BEGIN_NAMESPACE
@@ -165,6 +166,8 @@ public:
typedef T* iterator;
typedef const T* const_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
inline iterator begin() { return ptr; }
inline const_iterator begin() const { return ptr; }
@@ -174,6 +177,12 @@ public:
inline const_iterator end() const { return ptr + s; }
inline const_iterator cend() const { return ptr + s; }
inline const_iterator constEnd() const { return ptr + s; }
+ reverse_iterator rbegin() { return reverse_iterator(end()); }
+ reverse_iterator rend() { return reverse_iterator(begin()); }
+ const_reverse_iterator rbegin() const { return const_reverse_iterator(end()); }
+ const_reverse_iterator rend() const { return const_reverse_iterator(begin()); }
+ const_reverse_iterator crbegin() const { return const_reverse_iterator(end()); }
+ const_reverse_iterator crend() const { return const_reverse_iterator(begin()); }
iterator insert(const_iterator before, int n, const T &x);
inline iterator insert(const_iterator before, const T &x) { return insert(before, 1, x); }
iterator erase(const_iterator begin, const_iterator end);
diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc
index 5533a7d663..1f3a73073f 100644
--- a/src/corelib/tools/qvarlengtharray.qdoc
+++ b/src/corelib/tools/qvarlengtharray.qdoc
@@ -459,6 +459,20 @@
Typedef for T *. Provided for STL compatibility.
*/
+/*!
+ \typedef QVarLengthArray::const_reverse_iterator
+ \since 5.6
+
+ Typedef for \c{std::reverse_iterator<const T*>}. Provided for STL compatibility.
+*/
+
+/*!
+ \typedef QVarLengthArray::reverse_iterator
+ \since 5.6
+
+ Typedef for \c{std::reverse_iterator<T*>}. Provided for STL compatibility.
+*/
+
/*! \fn void QVarLengthArray::prepend(const T &value)
\since 4.8
@@ -573,6 +587,52 @@
\sa constBegin(), end()
*/
+/*! \fn QVarLengthArray::reverse_iterator QVarLengthArray::rbegin()
+ \since 5.6
+
+ Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to the first
+ item in the variable length array, in reverse order.
+
+ \sa begin(), crbegin(), rend()
+*/
+
+/*! \fn QVarLengthArray::const_reverse_iterator QVarLengthArray::rbegin() const
+ \since 5.6
+ \overload
+*/
+
+/*! \fn QVarLengthArray::const_reverse_iterator QVarLengthArray::crbegin() const
+ \since 5.6
+
+ Returns a const \l{STL-style iterators}{STL-style} reverse iterator pointing to the first
+ item in the variable length array, in reverse order.
+
+ \sa begin(), rbegin(), rend()
+*/
+
+/*! \fn QVarLengthArray::reverse_iterator QVarLengthArray::rend()
+ \since 5.6
+
+ Returns a \l{STL-style iterators}{STL-style} reverse iterator pointing to one past
+ the last item in the variable length array, in reverse order.
+
+ \sa end(), crend(), rbegin()
+*/
+
+/*! \fn QVarLengthArray::const_reverse_iterator QVarLengthArray::rend() const
+ \since 5.6
+ \overload
+*/
+
+/*! \fn QVarLengthArray::const_reverse_iterator QVarLengthArray::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 variable length array, in reverse order.
+
+ \sa end(), rend(), rbegin()
+*/
+
/*! \fn QVarLengthArray::iterator QVarLengthArray::erase(const_iterator pos)
\since 4.8