]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Use std::_Destroy in std::stacktrace
authorJonathan Wakely <jwakely@redhat.com>
Thu, 28 Nov 2024 12:38:22 +0000 (12:38 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 28 Nov 2024 18:46:16 +0000 (18:46 +0000)
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.

libstdc++-v3/include/std/stacktrace

index 2c0f6ba10a91e702581031eda56e13e77daa1517..f94a424e4cff679daf29c8656d027e122ecf7276 100644 (file)
@@ -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;
        }