[libcxx-commits] [PATCH] D153991: [libc++] explicitly specialises `unique_ptr` when using `default_delete`

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 29 07:56:32 PDT 2023


ldionne added inline comments.


================
Comment at: libcxx/include/__memory/unique_ptr.h:710-712
+#if defined(_LIBCPP_EXACTLY_ONE_DEFAULT_DELETE_PER_TYPE)
+  inline static deleter_type __deleter;
+#else
----------------
I believe that makes us non-conforming? `get_deleter()` returns a reference to that, so different deleters need to have different addresses. It's a bit pedantic for sure, but this still seems like not what the standard intended us to implement `unique_ptr` as.

If we get the same (or almost the same) benefits from simply avoiding `__compressed_pair`, I would personally prefer that approach.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153991



More information about the libcxx-commits mailing list