From 61a54ea68e63aee498a3dd938fbb7fe58416046f Mon Sep 17 00:00:00 2001 From: Takeshi Abe Date: Mon, 6 Aug 2018 12:48:17 +0900 Subject: sw: Prefer std::vector for SwLineOffsetArray to std::list as its instance adds an element only at the end, and no erase. Change-Id: I41dc7c4d0f7d070b7ce0cef2e36ee73c05f342ae Reviewed-on: https://gerrit.libreoffice.org/58635 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sw/source/core/table/swnewtable.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx index 4c78fa0d1ceb..33fb40cd0319 100644 --- a/sw/source/core/table/swnewtable.cxx +++ b/sw/source/core/table/swnewtable.cxx @@ -1201,7 +1201,7 @@ void SwTable::InsertSpannedRow( SwDoc* pDoc, sal_uInt16 nRowIdx, sal_uInt16 nCnt } typedef std::pair< sal_uInt16, sal_uInt16 > SwLineOffset; -typedef std::list< SwLineOffset > SwLineOffsetArray; +typedef std::vector< SwLineOffset > SwLineOffsetArray; /* * When a couple of table boxes has to be split, @@ -1260,8 +1260,7 @@ static void lcl_SophisticatedFillLineIndices( SwLineOffsetArray &rArr, } OSL_ENSURE( aLnOfs.second < nCnt, "Clean-up failed" ); aLnOfs.second = nCnt - aLnOfs.second; // the number of rows to insert - rArr.insert( rArr.end(), - SwLineOffset( aLnOfs.first - nSum, aLnOfs.second ) ); + rArr.emplace_back( aLnOfs.first - nSum, aLnOfs.second ); // the correction has to be incremented because in the following // loops the line ends were manipulated nSum = nSum + aLnOfs.second; -- cgit