[libcxx-commits] [libcxx] [libc++] Merge the implementations of ranges::copy_n and std::copy_n and fix vector::insert to assign (PR #157444)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Sat Sep 20 06:29:51 PDT 2025


================
@@ -640,14 +639,7 @@ class vector {
             __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) {
-#if _LIBCPP_STD_VER >= 23
-    if constexpr (!forward_iterator<_Iterator>) { // Handles input-only sized ranges for insert_range
-      ranges::copy_n(std::move(__first), __n, __position);
-    } else
-#endif
-    {
-      std::copy_n(__first, __n, __position);
-    }
+    std::__copy_n(__first, __n, __position);
----------------
philnik777 wrote:

Turns out that the SFINAE was incorrect which is why this wasn't caught before.

https://github.com/llvm/llvm-project/pull/157444


More information about the libcxx-commits mailing list