[libcxx-commits] [libcxx] [libc++][NFC] Reorder shared_ptr allocation functions (PR #206031)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jul 6 05:04:59 PDT 2026


================
@@ -877,13 +831,28 @@ allocate_shared(const _Alloc& __a, const remove_extent_t<_Tp>& __u) {
   return std::__allocate_shared_bounded_array<_Tp>(__a, __u);
 }
 
-template <class _Tp, class _Alloc, __enable_if_t<is_bounded_array<_Tp>::value, int> = 0>
-[[nodiscard]] _LIBCPP_HIDE_FROM_ABI shared_ptr<_Tp> allocate_shared_for_overwrite(const _Alloc& __a) {
-  using _ForOverwriteAllocator = __allocator_traits_rebind_t<_Alloc, __for_overwrite_tag>;
-  _ForOverwriteAllocator __alloc(__a);
-  return std::__allocate_shared_bounded_array<_Tp>(__alloc);
+template <class _Tp, class _Alloc, __enable_if_t<is_unbounded_array<_Tp>::value, int> = 0>
----------------
philnik777 wrote:

I think interleaving the control blocks and public API is a bit confusing. I'd rather have the overload sets together.

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


More information about the libcxx-commits mailing list