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 7cbdc8abbd.
Amends 2457dd8bd0.

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;
}
qsizetype n = 0;
if constexpr (IsFwdIt && noexcept(T(*first))) {
qsizetype n;
if constexpr (IsFwdIt) {
dst = std::uninitialized_copy(first, last, dst);
n = dst - begin();
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).
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.
*/
@ -1016,7 +1017,9 @@
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.
\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.
*/