summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qvarlengtharray.qdoc
diff options
context:
space:
mode:
authorDennis Oberst <dennis.oberst@qt.io>2022-12-21 14:12:05 +0100
committerDennis Oberst <dennis.oberst@qt.io>2023-02-08 21:13:08 +0100
commit7cbdc8abbda12488f51317313347bbc220b42fe0 (patch)
tree2babcf1fc2b0d53eaf56196477a6323935f6dc9c /src/corelib/tools/qvarlengtharray.qdoc
parent65cda1f06aa24d9b75e81b37a5c23dcedbc53b92 (diff)
QVarLengthArray: add STL-style assign()
Implemented assign() methods for QVarLengthArray to align with the criteria of std::vector, addressing the previously missing functionality. Reference: https://en.cppreference.com/w/cpp/container/vector/assign [ChangeLog][QtCore][QVarLengthArray] Added assign(). Fixes: QTBUG-106200 Change-Id: If671069808ff561b0f4c77b6c7f7aca360a0c663 Reviewed-by: Marc Mutz <marc.mutz@qt.io>
Diffstat (limited to 'src/corelib/tools/qvarlengtharray.qdoc')
-rw-r--r--src/corelib/tools/qvarlengtharray.qdoc40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/corelib/tools/qvarlengtharray.qdoc b/src/corelib/tools/qvarlengtharray.qdoc
index 4f41304c03..3ad8a82857 100644
--- a/src/corelib/tools/qvarlengtharray.qdoc
+++ b/src/corelib/tools/qvarlengtharray.qdoc
@@ -103,11 +103,14 @@
lists.
*/
-/*! \fn template<class T, qsizetype Prealloc> template<typename InputIterator> QVarLengthArray<T, Prealloc>::QVarLengthArray(InputIterator first, InputIterator last)
+/*! \fn template<class T, qsizetype Prealloc> template<typename InputIterator, if_input_iterator<InputIterator>> QVarLengthArray<T, Prealloc>::QVarLengthArray(InputIterator first, InputIterator last)
\since 5.14
Constructs an array with the contents in the iterator range [\a first, \a last).
+ This constructor only participates in overload resolution if
+ \c InputIterator models the \c std::input_iterator concept.
+
The value type of \c InputIterator must be convertible to \c T.
*/
@@ -992,3 +995,38 @@
\sa erase()
*/
+
+/*! \fn template <class T, qsizetype Prealloc> void QVarLengthArray<T, Prealloc>::assign(qsizetype n, const T &t)
+ \since 6.6
+
+ Replaces the contents of this container with \a n copies of \a t.
+
+ The size of this container will be equal to \a n. This function will only
+ allocate memory if \a n exceeds the capacity of the container.
+*/
+
+/*! \fn template <class T, qsizetype Prealloc> template <typename InputIterator, if_input_iterator<InputIterator>> void QVarLengthArray<T, Prealloc>::assign(InputIterator first, InputIterator last)
+ \since 6.6
+
+ Replaces the contents of this container with a copy of the elements in the
+ iterator range [\a first, \a last).
+
+ The size of this container will be equal to the number of elements in the
+ range [\a first, \a last). This function will only allocate memory if the
+ number of elements in the range exceeds the capacity of the container.
+
+ This function overload only participates in overload resolution if
+ \c InputIterator models the \c std::input_iterator concept.
+ The behavior is undefined if either argument is an iterator into *this.
+*/
+
+/*! \fn template <class T, qsizetype Prealloc> void QVarLengthArray<T, Prealloc>::assign(std::initializer_list<T> list)
+ \since 6.6
+
+ Replaces the contents of this container with a copy of the elements of \a list.
+
+ The size of this container will be equal to the number of elements in \a list.
+
+ This function only allocates memory if the number of elements in \a list
+ exceeds the capacity of the container.
+*/