sc/source/filter/excel/xepage.cxx             |    4 ++--
 sc/source/ui/unoobj/chart2uno.cxx             |    5 +----
 sw/source/core/doc/textboxhelper.cxx          |    3 +--
 sw/source/core/draw/dview.cxx                 |    4 ++--
 xmloff/source/chart/SchXMLPlotAreaContext.cxx |    5 +----
 5 files changed, 7 insertions(+), 14 deletions(-)

New commits:
commit 19f943f13485918d35597be1dcae48c0fbecd0e3
Author:     shlok3640 <[email protected]>
AuthorDate: Sat Jan 31 08:33:36 2026 +0000
Commit:     Ilmari Lauhakangas <[email protected]>
CommitDate: Sat Jan 31 12:30:33 2026 +0100

    tdf#163738: Use insert() instead of push_back loops
    
    Change-Id: If5bbf0fde172c0fd0a21e44141d7e53e0ae09cab
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198445
    Tested-by: Jenkins
    Tested-by: Ilmari Lauhakangas <[email protected]>
    Reviewed-by: Ilmari Lauhakangas <[email protected]>

diff --git a/sc/source/filter/excel/xepage.cxx 
b/sc/source/filter/excel/xepage.cxx
index 4a2a80e3076a..42a579229ec1 100644
--- a/sc/source/filter/excel/xepage.cxx
+++ b/sc/source/filter/excel/xepage.cxx
@@ -387,8 +387,8 @@ XclExpPageSettings::XclExpPageSettings( const XclExpRoot& 
rRoot ) :
 
     std::set<SCCOL> aColBreaks;
     rDoc.GetAllColBreaks(aColBreaks, nScTab, false, true);
-    for (const auto& rColBreak : aColBreaks)
-        maData.maVerPageBreaks.push_back(rColBreak);
+    maData.maVerPageBreaks.insert(maData.maVerPageBreaks.end(), 
aColBreaks.begin(),
+                                  aColBreaks.end());
 }
 
 namespace {
diff --git a/sc/source/ui/unoobj/chart2uno.cxx 
b/sc/source/ui/unoobj/chart2uno.cxx
index 224dcb33bbdb..42c6eaef4451 100644
--- a/sc/source/ui/unoobj/chart2uno.cxx
+++ b/sc/source/ui/unoobj/chart2uno.cxx
@@ -1544,10 +1544,7 @@ ScChart2DataProvider::createDataSource(
     //reorder labeled sequences according to aSequenceMapping
     std::vector< uno::Reference< chart2::data::XLabeledDataSequence > > 
aSeqVector;
     aSeqVector.reserve(aSeqs.size());
-    for (auto const& aSeq : aSeqs)
-    {
-        aSeqVector.push_back(aSeq);
-    }
+    aSeqVector.insert(aSeqVector.end(), aSeqs.begin(), aSeqs.end());
 
     for (const sal_Int32 nNewIndex : aSequenceMapping)
     {
diff --git a/sw/source/core/doc/textboxhelper.cxx 
b/sw/source/core/doc/textboxhelper.cxx
index bc4f11515187..62ced4d44011 100644
--- a/sw/source/core/doc/textboxhelper.cxx
+++ b/sw/source/core/doc/textboxhelper.cxx
@@ -1657,8 +1657,7 @@ std::vector<SwFrameFormat*> 
SwTextBoxHelper::CollectTextBoxes(const SdrObject* p
         for (const rtl::Reference<SdrObject>& pObj : *pChildren)
         {
             auto pChildTextBoxes = CollectTextBoxes(pObj.get(), pFormat);
-            for (auto& rChildTextBox : pChildTextBoxes)
-                vRet.push_back(rChildTextBox);
+            vRet.insert(vRet.end(), pChildTextBoxes.begin(), 
pChildTextBoxes.end());
         }
     }
     else
diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx
index 9bdf6acee63f..6f132c88d888 100644
--- a/sw/source/core/draw/dview.cxx
+++ b/sw/source/core/draw/dview.cxx
@@ -1009,8 +1009,8 @@ void SwDrawView::DeleteMarked()
             if (pObject->getChildrenOfSdrObject())
             {
                 auto pChildTextBoxes = 
SwTextBoxHelper::CollectTextBoxes(pObject, pFormat);
-                for (auto& rChildTextBox : pChildTextBoxes)
-                    aTextBoxesToDelete.push_back(rChildTextBox);
+                aTextBoxesToDelete.insert(aTextBoxesToDelete.end(), 
pChildTextBoxes.begin(),
+                                          pChildTextBoxes.end());
             }
             else if (SwFrameFormat* pTextBox
                      = SwTextBoxHelper::getOtherTextBoxFormat(pFormat, 
RES_DRAWFRMFMT))
diff --git a/xmloff/source/chart/SchXMLPlotAreaContext.cxx 
b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
index a1713ff45210..04f39639f58d 100644
--- a/xmloff/source/chart/SchXMLPlotAreaContext.cxx
+++ b/xmloff/source/chart/SchXMLPlotAreaContext.cxx
@@ -756,10 +756,7 @@ void SchXMLDataPointContext::startFastElement (sal_Int32 
/*Element*/,
                     Reference<beans::XPropertySet> 
xSeriesProp(mDataPoint.m_xSeries, uno::UNO_QUERY);
                     
xSeriesProp->getPropertyValue(u"DeletedLegendEntries"_ustr) >>= 
deletedLegendEntriesSeq;
                     std::vector<sal_Int32> deletedLegendEntries;
-                    for (const auto& deletedLegendEntry : 
deletedLegendEntriesSeq)
-                    {
-                        deletedLegendEntries.push_back(deletedLegendEntry);
-                    }
+                    deletedLegendEntries.insert(deletedLegendEntries.end(), 
deletedLegendEntriesSeq.begin(), deletedLegendEntriesSeq.end());
                     deletedLegendEntries.push_back(mDataPoint.m_nPointIndex);
                     
xSeriesProp->setPropertyValue(u"DeletedLegendEntries"_ustr, 
uno::Any(comphelper::containerToSequence(deletedLegendEntries)));
                 }

Reply via email to