Index: libcxx/include/__memory/uninitialized_algorithms.h =================================================================== --- libcxx/include/__memory/uninitialized_algorithms.h +++ libcxx/include/__memory/uninitialized_algorithms.h @@ -12,6 +12,7 @@ #include <__algorithm/copy.h> #include <__algorithm/move.h> +#include <__algorithm/unwrap_iter.h> #include <__config> #include <__iterator/iterator_traits.h> #include <__iterator/reverse_iterator.h> @@ -568,11 +569,10 @@ class _Type, class _RawType = __remove_const_t<_Type>, __enable_if_t< - // using _RawType because of the allocator extension is_trivially_copy_constructible<_RawType>::value && is_trivially_copy_assignable<_RawType>::value && __allocator_has_trivial_copy_construct<_Alloc, _RawType>::value>* = nullptr> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Type* -__uninitialized_allocator_copy(_Alloc&, const _Type* __first1, const _Type* __last1, _Type* __first2) { +__uninitialized_allocator_copy_impl(_Alloc&, const _Type* __first1, const _Type* __last1, _Type* __first2) { // TODO: Remove the const_cast once we drop support for std::allocator if (__libcpp_is_constant_evaluated()) { while (__first1 != __last1) { @@ -586,6 +586,19 @@ } } +template , + __enable_if_t< + // using _RawType because of the allocator extension + is_trivially_copy_constructible<_RawType>::value && is_trivially_copy_assignable<_RawType>::value && + __allocator_has_trivial_copy_construct<_Alloc, _RawType>::value>* = nullptr> +_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Type* +__uninitialized_allocator_copy(_Alloc& __alloc, const _Type* __first1, const _Type* __last1, _Type* __first2) { + return __uninitialized_allocator_copy_impl(__alloc, std::__unwrap_iter(__first1), std::__unwrap_iter(__last1), std::__unwrap_iter(__first2)); +} + + // Move-construct the elements [__first1, __last1) into [__first2, __first2 + N) // if the move constructor is noexcept, where N is distance(__first1, __last1). //