diff options
| author | hjk <[email protected]> | 2014-11-06 09:19:29 +0100 |
|---|---|---|
| committer | hjk <[email protected]> | 2014-11-06 11:33:52 +0100 |
| commit | d3f3e1218c07cad7f69eebe9b011bededb45bfa5 (patch) | |
| tree | 155d0289dfde0d3cc3ca961f329503a66935edae /src | |
| parent | 1031ad876142461c0256fc78648747171c1b48db (diff) | |
Add a inline QVector::append(const QVector &) overload
This is present in QList already and its lack is a nuisance when
switching from QList based code to QVector (which makes sense e.g.
if the item size exceeds sizeof(void*))
Also, albeit operator+=() and operator<<() exist, some people
simply prefer functions with real function names.
[ChangeLog][QtCore][QVector] Added QVector::append(const QVector &) overload
Change-Id: I9aae8223b086765625f2f3071fab5da0780f8a43
Reviewed-by: Liang Qi <[email protected]>
Reviewed-by: Olivier Goffart <[email protected]>
Diffstat (limited to 'src')
| -rw-r--r-- | src/corelib/tools/qvector.cpp | 12 | ||||
| -rw-r--r-- | src/corelib/tools/qvector.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/corelib/tools/qvector.cpp b/src/corelib/tools/qvector.cpp index 99e1db1cabd..50c90ad7463 100644 --- a/src/corelib/tools/qvector.cpp +++ b/src/corelib/tools/qvector.cpp @@ -463,6 +463,18 @@ \sa operator<<(), prepend(), insert() */ +/*! \fn void QVector::append(const QVector<T> &value) + + \overload + + \since 5.5 + + Appends the items of the \a value vector to this vector. + + \sa operator<<(), operator+=() +*/ + + /*! \fn void QVector::prepend(const T &value) Inserts \a value at the beginning of the vector. diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index 9c8d9d4cf83..c00bd07a72e 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -128,6 +128,7 @@ public: T &operator[](int i); const T &operator[](int i) const; void append(const T &t); + inline void append(const QVector<T> &l) { *this += l; } void prepend(const T &t); void insert(int i, const T &t); void insert(int i, int n, const T &t); |
