We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3deee23 commit e2ec5a0Copy full SHA for e2ec5a0
libcxx/include/__vector/vector.h
@@ -1017,9 +1017,14 @@ template <class _Tp, class _Allocator>
1017
template <class _Iterator, class _Sentinel>
1018
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
1019
vector<_Tp, _Allocator>::__assign_with_sentinel(_Iterator __first, _Sentinel __last) {
1020
- clear();
1021
- for (; __first != __last; ++__first)
1022
- emplace_back(*__first);
+ pointer __cur = __begin_;
+ for (; __first != __last && __cur != __end_; ++__cur, ++__first)
+ *__cur = *__first;
1023
+ if (__cur != __end_)
1024
+ __destruct_at_end(__cur);
1025
+ else
1026
+ for (; __first != __last; ++__first)
1027
+ emplace_back(*__first);
1028
}
1029
1030
template <class _Tp, class _Allocator>
0 commit comments