summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qvarlengtharray.qdoc
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2017-02-17 00:58:11 +0100
committerMarc Mutz <marc.mutz@kdab.com>2017-02-25 21:04:01 +0000
commit1d31f23ce9dd438e68aee0dbf1907e17b0d66db3 (patch)
tree65e46756713839f77d92ee54069535b7f0385b03 /src/corelib/tools/qvarlengtharray.qdoc
parent63856135dacba615ebfabdf03be2926dc763358f (diff)
QVarLengthArray: add rvalue overload of append/push_back
Improves performance when appending temporaries, esp. since the aliasing fix in the lvalue overload in 0f730ef made that overload correct, but a bit slower across reallocs. The unit tests already also pass rvalues, so the function is covered in the existing tests. [ChangeLog][QtCore][QVarLengthArray] Added rvalue overloads of append() and push_back(). Change-Id: If3a6970f03a160cba5b42d33d32d3d18948f6ce3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/corelib/tools/qvarlengtharray.qdoc')
-rw-r--r--src/corelib/tools/qvarlengtharray.qdoc28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc
index 5e53a969e8..127afcd069 100644
--- a/src/corelib/tools/qvarlengtharray.qdoc
+++ b/src/corelib/tools/qvarlengtharray.qdoc
@@ -303,6 +303,34 @@
*/
/*!
+ \fn void QVarLengthArray::append(T &&t)
+ \overload append
+ \since 5.9
+
+ \note Unlike the lvalue overload of append(), passing a reference to
+ an object that is already an element of \c *this leads to undefined
+ behavior:
+
+ \code
+ vla.append(std::move(vla[0])); // BUG: passing an object that is already in the container
+ \endcode
+*/
+
+/*!
+ \fn void QVarLengthArray::push_back(T &&t)
+ \overload push_back
+ \since 5.9
+
+ \note Unlike the lvalue overload of push_back(), passing a reference to
+ an object that is already an element of \c *this leads to undefined
+ behavior:
+
+ \code
+ vla.push_back(std::move(vla[0])); // BUG: passing an object that is already in the container
+ \endcode
+*/
+
+/*!
\fn inline void QVarLengthArray::removeLast()
\since 4.5