https://gcc.gnu.org/g:1e2b03e4d66d894c2e42d209502b6957b2dabbf9

commit r15-5765-g1e2b03e4d66d894c2e42d209502b6957b2dabbf9
Author: Jonathan Wakely <jwak...@redhat.com>
Date:   Thu Nov 28 12:38:22 2024 +0000

    libstdc++: Use std::_Destroy in std::stacktrace
    
    This benefits from the optimizations in std::_Destroy which avoid doing
    any work when using std::allocator.
    
    libstdc++-v3/ChangeLog:
    
            * include/std/stacktrace (basic_stacktrace::_M_impl::_M_resize):
            Use std::_Destroy to destroy removed elements.

Diff:
---
 libstdc++-v3/include/std/stacktrace | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libstdc++-v3/include/std/stacktrace 
b/libstdc++-v3/include/std/stacktrace
index 2c0f6ba10a91..f94a424e4cff 100644
--- a/libstdc++-v3/include/std/stacktrace
+++ b/libstdc++-v3/include/std/stacktrace
@@ -601,8 +601,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        void
        _M_resize(size_type __n, allocator_type& __alloc) noexcept
        {
-         for (size_type __i = __n; __i < _M_size; ++__i)
-           _AllocTraits::destroy(__alloc, &_M_frames[__i]);
+         std::_Destroy(_M_frames + __n, _M_frames + _M_size, __alloc);
          _M_size = __n;
        }

Reply via email to