[libcxx-commits] [libcxx] [libc++] Fix assignment in insertion into `vector` (PR #116001)
Peng Liu via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jan 28 08:35:36 PST 2025
================
@@ -594,6 +598,30 @@ class _LIBCPP_TEMPLATE_VIS vector {
_LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
__assign_with_size(_ForwardIterator __first, _Sentinel __last, difference_type __n);
+ template <class _Iterator,
+ __enable_if_t<!is_same<decltype(*std::declval<_Iterator&>())&&, value_type&&>::value, int> = 0>
+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
+ __insert_assign_n_unchecked(_Iterator __first, difference_type __n, pointer __position) {
+ for (pointer __end_position = __position + __n; __position != __end_position; (void)++__position, ++__first) {
----------------
winner245 wrote:
```suggestion
for (pointer __end_position = __position + __n; __position != __end_position; ++__position, (void)++__first) {
```
I think it is more appropriate to guard against `operator,` here.
https://github.com/llvm/llvm-project/pull/116001
More information about the libcxx-commits
mailing list