[libcxx-commits] [PATCH] D152208: [libc++] Introduce __uninitialized_buffer and use it instead of get_temporary_buffer
Nikolas Klauser via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Jun 6 12:05:51 PDT 2023
philnik added a comment.
In D152208#4400227 <https://reviews.llvm.org/D152208#4400227>, @Mordante wrote:
> Would it make sense to add some internal tests for this class?
Since I changed this to using a `unqiue_ptr` I don't think it makes a lot of sense to add any internal tests.
================
Comment at: libcxx/include/__algorithm/stable_partition.h:143
{
-// TODO: Remove the use of std::get_temporary_buffer
-_LIBCPP_SUPPRESS_DEPRECATED_PUSH
- __p = _VSTD::get_temporary_buffer<value_type>(__len);
-_LIBCPP_SUPPRESS_DEPRECATED_POP
- __h.reset(__p.first);
+ __uninitialized_buffer<value_type, __destruct::__never> __buf(__len);
+ return std::__stable_partition_impl<_AlgPolicy, _Predicate&>(
----------------
Mordante wrote:
> Is never correct when the type does things in its destructor?
> Or are all elements in a moved from state?
All the elements get destructed by `__stable_partition_impl`, so the buffer doesn't have to do anything other than deleting the allocation.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152208/new/
https://reviews.llvm.org/D152208
More information about the libcxx-commits
mailing list