QVarLengthArray: remove unnecessary exception check

The previous check for a non-throwing copy constructor at:

    if constexpr (IsFwdIt && noexcept(T(*first)))

is not necessary as std::uninitialized_copy provides strong exception
safety.

Additionally, change the phrasing of the overload-resolution \note,
since we're not requiring C++20 std::input_iterator, but the older
C++17 definition.

Amends 7cbdc8abbda12488f51317313347bbc220b42fe0.
Amends 2457dd8bd0a0a2be567173e3bb9dbfeb1318a02b.

Change-Id: Ie36c8d70dc61aa8cc2a30c9d4110d1beb0d1c2fe
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Dennis Oberst 2023-04-26 15:53:23 +02:00 committed by Marc Mutz
parent 6e2bba71bb
commit 4d404c2936
2 changed files with 7 additions and 4 deletions

View File

@ -796,8 +796,8 @@ Q_OUTOFLINE_TEMPLATE void QVLABase<T>::assign_impl(qsizetype prealloc, void *arr
++first; ++first;
} }
qsizetype n = 0; qsizetype n;
if constexpr (IsFwdIt && noexcept(T(*first))) { if constexpr (IsFwdIt) {
dst = std::uninitialized_copy(first, last, dst); dst = std::uninitialized_copy(first, last, dst);
n = dst - begin(); n = dst - begin();
if (n > s) // otherwise: readjust 's' in erase() later if (n > s) // otherwise: readjust 's' in erase() later

View File

@ -109,7 +109,8 @@
Constructs an array with the contents in the iterator range [\a first, \a last). Constructs an array with the contents in the iterator range [\a first, \a last).
This constructor only participates in overload resolution if This constructor only participates in overload resolution if
\c InputIterator models the \c std::input_iterator concept. \c InputIterator meets the requirements of an
\l {https://en.cppreference.com/w/cpp/named_req/InputIterator} {LegacyInputIterator}.
The value type of \c InputIterator must be convertible to \c T. The value type of \c InputIterator must be convertible to \c T.
*/ */
@ -1016,7 +1017,9 @@
number of elements in the range exceeds the capacity of the container. number of elements in the range exceeds the capacity of the container.
This function overload only participates in overload resolution if This function overload only participates in overload resolution if
\c InputIterator models the \c std::input_iterator concept. \c InputIterator meets the requirements of an
\l {https://en.cppreference.com/w/cpp/named_req/InputIterator} {LegacyInputIterator}.
The behavior is undefined if either argument is an iterator into *this. The behavior is undefined if either argument is an iterator into *this.
*/ */