From 4381d485fc2634fee7667f3fe765f4ef712e7b3b Mon Sep 17 00:00:00 2001 From: Mehul Sharma Date: Sat, 11 Apr 2026 03:14:39 +0530 Subject: [PATCH] tdf#163738 Use insert() to add multiple values in containers instead of loop Replace push_back with corresponding insert without changing the behaviour of the code Change-Id: Ib09ee67400131d68ce84148b8affcc881aecdd38 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/203415 Reviewed-by: Ilmari Lauhakangas Tested-by: Jenkins --- chart2/source/model/main/DataSeries.cxx | 5 +---- lotuswordpro/source/filter/lwpstory.cxx | 5 +---- vcl/source/app/salvtables.cxx | 3 +-- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/chart2/source/model/main/DataSeries.cxx b/chart2/source/model/main/DataSeries.cxx index 04526adea5ad..38121fc99adb 100644 --- a/chart2/source/model/main/DataSeries.cxx +++ b/chart2/source/model/main/DataSeries.cxx @@ -392,10 +392,7 @@ void SAL_CALL DataSeries::setData( const uno::Sequence< Reference< chart2::data: MutexGuard aGuard( m_aMutex ); xModifyEventForwarder = m_xModifyEventForwarder; std::swap( aOldDataSequences, m_aDataSequences ); - for (const auto & i : aData) - { - aNewDataSequences.push_back(i); - } + aNewDataSequences.insert(aNewDataSequences.end(), aData.begin(), aData.end()); m_aDataSequences = aNewDataSequences; } ModifyListenerHelper::removeListenerFromAllElements( aOldDataSequences, xModifyEventForwarder ); diff --git a/lotuswordpro/source/filter/lwpstory.cxx b/lotuswordpro/source/filter/lwpstory.cxx index 540afd3dc661..8de8757c07b1 100644 --- a/lotuswordpro/source/filter/lwpstory.cxx +++ b/lotuswordpro/source/filter/lwpstory.cxx @@ -233,10 +233,7 @@ void LwpStory::SortPageLayout() //put all the sorted layouts into list m_LayoutList.clear(); - for (auto const& layout : aLayoutList) - { - m_LayoutList.push_back(layout); - } + m_LayoutList.insert(m_LayoutList.end(), aLayoutList.begin(), aLayoutList.end()); } /************************************************************************** diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 9fce499f4eef..9be62436d936 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -3906,8 +3906,7 @@ void SalInstanceTreeView::columns_autosize() { std::vector aColWidths; aColWidths.push_back(aWidths[1] + aWidths[0]); - for (size_t i = 2; i < aWidths.size(); ++i) - aColWidths.push_back(aWidths[i]); + aColWidths.insert(aColWidths.end(), aWidths.begin() + 2, aWidths.end()); // take column headers into account if (VclPtr pTabListBox