diff options
author | Thorbjørn Martsum <tmartsum@gmail.com> | 2013-02-13 17:48:49 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-07 06:12:59 +0100 |
commit | 510660080de6fab87e117de2663c33eff5ae451b (patch) | |
tree | 20edeb768f3dbfb2b4e85c86d4d3ede6a04e41b0 /src/corelib/tools/qvector.cpp | |
parent | d1308232d31cb0b414e844fb18c8a02b7cba62c1 (diff) |
QVector - add remove functions
This patch adds the functions removeFirst() and removeLast().
Functions that QList has.
Beside making these functions, pop_back and pop_front are
redirected to these rather than calling erase.
Change-Id: Ifc5f8a78e33f436f06f21095a920ec5d4311fd6f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qvector.cpp')
-rw-r--r-- | src/corelib/tools/qvector.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp index efc4b6a446..5ece011f0b 100644 --- a/src/corelib/tools/qvector.cpp +++ b/src/corelib/tools/qvector.cpp @@ -544,6 +544,26 @@ \sa insert(), replace(), fill() */ +/*! \fn void QVector::removeFirst() + \since 5.1 + Removes the first item in the vector. Calling this function is + equivalent to calling remove(0). The vector must not be empty. If + the vector can be empty, call isEmpty() before calling this + function. + + \sa remove(), isEmpty() +*/ + +/*! \fn void QVector::removeLast() + \since 5.1 + Removes the last item in the vector. Calling this function is + equivalent to calling remove(size() - 1). The vector must not be + empty. If the vector can be empty, call isEmpty() before calling + this function. + + \sa remove(), removeFirst(), isEmpty() +*/ + /*! \fn QVector &QVector::fill(const T &value, int size = -1) Assigns \a value to all items in the vector. If \a size is @@ -773,13 +793,13 @@ /*! \fn void QVector::pop_front() This function is provided for STL compatibility. It is equivalent - to erase(begin()). + to removeFirst(). */ /*! \fn void QVector::pop_back() This function is provided for STL compatibility. It is equivalent - to erase(end() - 1). + to removeLast(). */ /*! \fn T& QVector::front() |