[libcxx-commits] [libcxx] [libc++] Accept iterators instead of raw pointers in __uninitialized_allocator_relocate (PR #114552)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Sat Nov 2 09:48:31 PDT 2024


================
@@ -611,20 +611,22 @@ struct __allocator_has_trivial_destroy<allocator<_Tp>, _Up> : true_type {};
 //                 [__first, __last) doesn't contain any objects
 //
 // The strong exception guarantee is provided if any of the following are true:
-// - is_nothrow_move_constructible<_Tp>
-// - is_copy_constructible<_Tp>
-// - __libcpp_is_trivially_relocatable<_Tp>
-template <class _Alloc, class _Tp>
-_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void
-__uninitialized_allocator_relocate(_Alloc& __alloc, _Tp* __first, _Tp* __last, _Tp* __result) {
+// - is_nothrow_move_constructible<_ValueType>
+// - is_copy_constructible<_ValueType>
+// - __libcpp_is_trivially_relocatable<_ValueType>
+template <class _Alloc, class _ContiguousIterator>
+_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 void __uninitialized_allocator_relocate(
+    _Alloc& __alloc, _ContiguousIterator __first, _ContiguousIterator __last, _ContiguousIterator __result) {
----------------
frederick-vs-ja wrote:

The call sites pass both fancy and raw pointers. Perhaps we need to make this function template more generic.

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


More information about the libcxx-commits mailing list