[libcxx-commits] [libcxx] [libc++] Extract destroy algorithms into separate headers (PR #126449)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Feb 10 06:07:58 PST 2025
================
@@ -70,28 +67,12 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __destroy_at(_Tp* __loc
template <class _Tp, __enable_if_t<is_array<_Tp>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __destroy_at(_Tp* __loc) {
_LIBCPP_ASSERT_NON_NULL(__loc != nullptr, "null pointer given to destroy_at");
- std::__destroy(std::begin(*__loc), std::end(*__loc));
+ auto const __end = std::end(*__loc);
+ for (auto __it = std::begin(*__loc); __it != __end; ++__it)
+ std::__destroy_at(__it);
----------------
philnik777 wrote:
Just to note: the previous implementation was based on the standard wording. I think this is simple enough that the change in implementation is fine.
https://github.com/llvm/llvm-project/pull/126449
More information about the libcxx-commits
mailing list