[libcxx-commits] [libcxx] [libc++][NFC] Reorder shared_ptr allocation functions (PR #206031)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jun 26 07:51:07 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>
----------------
ldionne wrote:
I think we should try to consistently have: control-block, then public API function.
Right now that's true for `__shared_ptr_emplace` and `allocate_shared`, but not for the array (bounded and unbounded) ones.
https://github.com/llvm/llvm-project/pull/206031
More information about the libcxx-commits
mailing list