summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qvector.cpp
diff options
context:
space:
mode:
authorThorbjørn Martsum <tmartsum@gmail.com>2013-02-16 20:20:35 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-07 06:13:06 +0100
commitab52e722926d495e29263e59a466ad5ff0106275 (patch)
tree75bb1f0b3e408b20f944b325b6c55141eb2829cd /src/corelib/tools/qvector.cpp
parent510660080de6fab87e117de2663c33eff5ae451b (diff)
QVector - add functions takeFirst and takeLast
This patch adds takeFirst and takeLast which are functions that QList also has. Change-Id: I761f90b529774edc8fa96e07c6fcf76226123b20 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qvector.cpp')
-rw-r--r--src/corelib/tools/qvector.cpp26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp
index 5ece011f0b..e72c1964a2 100644
--- a/src/corelib/tools/qvector.cpp
+++ b/src/corelib/tools/qvector.cpp
@@ -551,7 +551,7 @@
the vector can be empty, call isEmpty() before calling this
function.
- \sa remove(), isEmpty()
+ \sa remove(), takeFirst(), isEmpty()
*/
/*! \fn void QVector::removeLast()
@@ -561,9 +561,31 @@
empty. If the vector can be empty, call isEmpty() before calling
this function.
- \sa remove(), removeFirst(), isEmpty()
+ \sa remove(), takeLast(), removeFirst(), isEmpty()
*/
+/*! \fn T QVector::takeFirst()
+
+ Removes the first item in the vector and returns it. This function
+ assumes the vector is not empty. To avoid failure, call isEmpty()
+ before calling this function.
+
+ \sa takeLast(), removeFirst()
+*/
+
+/*! \fn T QVector::takeLast()
+
+ Removes the last item in the list and returns it. This function
+ assumes the vector is not empty. To avoid failure, call isEmpty()
+ before calling this function.
+
+ If you don't use the return value, removeLast() is more
+ efficient.
+
+ \sa takeFirst(), removeLast()
+*/
+
+
/*! \fn QVector &QVector::fill(const T &value, int size = -1)
Assigns \a value to all items in the vector. If \a size is