[libcxx-commits] [PATCH] D93071: [libc++] NFCI: Implement make_shared as allocate_shared with std::allocator

Glen Fernandes via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 15 21:58:13 PST 2020


glenjofe added a comment.

In D93071#2447152 <https://reviews.llvm.org/D93071#2447152>, @ldionne wrote:

> @glenjofe  Taking a chance to tag you here since you've been involved in most changes to `std::shared_ptr` (and Peter Dimov does not appear to be on Phabricator). Was the intent that `make_shared` could be implemented via `allocate_shared` with the default allocator, or am I missing something subtle?

My implementation Boost's does: https://github.com/boostorg/smart_ptr/blob/develop/include/boost/smart_ptr/make_shared_array.hpp

i.e. Those `boost::make_shared` overloads just call `boost::allocate_shared` with `boost::default_allocator`

It would be nice to do specify `std::make_shared` overloads in the standard as just returning `std::allocate_shared` with `std::allocator` but we would need wording for that.

As pointed out users can specialize `std::allocator` and some even specialize `std::allocator_traits`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D93071



More information about the libcxx-commits mailing list