[libcxx-commits] [PATCH] D62641: Support arrays in make_shared and allocate_shared (P0674R1)

Zoe Carver via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Feb 15 13:44:10 PST 2021


zoecarver marked 3 inline comments as done.
zoecarver added inline comments.


================
Comment at: libcxx/include/memory:2720
+_LIBCPP_HIDE_FROM_ABI
+void __shared_ptr_array_construct_elements(_Alloc const& __alloc, _ValueType *__first, size_t __n, _Args&& ...__args) {
+    using _ValueAlloc = typename __allocator_traits_rebind<_Alloc, _ValueType>::type;
----------------
zoecarver wrote:
> Why not pass by value?
Whoops. I thought I deleted this comment. This was just a note to myself. 

Anyway, I am actually wondering about this. I see `_Alloc const&` all over the place, but allocators are generally supposed to be small (often empty) types, so why not pass them by value? We're copy constructing the allocator in this function, so it can't be to prevent that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62641/new/

https://reviews.llvm.org/D62641



More information about the libcxx-commits mailing list