diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2017-11-11 07:13:15 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2017-11-11 08:27:19 +0100 |
commit | e1f523a9f6808b895caab266c7eb3b2839b5e4ce (patch) | |
tree | 237a1acf53fa9e27a36cc08a2dcd914eacaf69d2 /sc/source | |
parent | ce470df92913ffc1849de90b9fd6a2a9d69b8e33 (diff) |
Replace list by vector in funcdesc (sc)
+ use for range loops
Change-Id: I896775db65cfddbe30a91b12f1d3a1633f49c068
Reviewed-on: https://gerrit.libreoffice.org/44619
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'sc/source')
-rw-r--r-- | sc/source/core/data/funcdesc.cxx | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/sc/source/core/data/funcdesc.cxx b/sc/source/core/data/funcdesc.cxx index e3ced8eb39e9..83f0501f5b38 100644 --- a/sc/source/core/data/funcdesc.cxx +++ b/sc/source/core/data/funcdesc.cxx @@ -327,10 +327,9 @@ void ScFuncDesc::fillVisibleArgumentMapping(::std::vector<sal_uInt16>& _rArgumen if (!bHasSuppressedArgs || !pDefArgFlags) { _rArguments.resize( nArgCount); - ::std::vector<sal_uInt16>::iterator iter = _rArguments.begin(); sal_uInt16 value = 0; - while (iter != _rArguments.end()) - *iter++ = value++; + for (auto & argument : _rArguments) + argument = value++; } _rArguments.reserve( nArgCount); @@ -817,7 +816,7 @@ ScFunctionList::ScFunctionList() ScFuncDesc* pDesc = nullptr; sal_Int32 nStrLen = 0; - ::std::list<ScFuncDesc*> tmpFuncList; + ::std::vector<const ScFuncDesc*> tmpFuncVector; // Browse for all possible OpCodes. This is not the fastest method, but // otherwise the sub resources within the resource blocks and the @@ -848,7 +847,7 @@ ScFunctionList::ScFunctionList() else { pDesc->nFIndex = i; - tmpFuncList.push_back(pDesc); + tmpFuncVector.push_back(pDesc); nStrLen = (*(pDesc->pFuncName)).getLength(); if (nStrLen > nMaxFuncNameLen) @@ -877,10 +876,9 @@ ScFunctionList::ScFunctionList() OUString aArgName, aArgDesc; const LegacyFuncCollection& rLegacyFuncColl = *ScGlobal::GetLegacyFuncCollection(); - LegacyFuncCollection::const_iterator it = rLegacyFuncColl.begin(), itEnd = rLegacyFuncColl.end(); - for (; it != itEnd; ++it) + for (auto const& legacyFunc : rLegacyFuncColl) { - const LegacyFuncData *const pLegacyFuncData = it->second.get(); + const LegacyFuncData *const pLegacyFuncData = legacyFunc.second.get(); pDesc = new ScFuncDesc; sal_uInt16 nArgs = pLegacyFuncData->GetParamCount() - 1; pLegacyFuncData->getParamDesc( aArgName, aArgDesc, 0 ); @@ -962,7 +960,7 @@ ScFunctionList::ScFunctionList() } } - tmpFuncList.push_back(pDesc); + tmpFuncVector.push_back(pDesc); nStrLen = (*(pDesc->pFuncName)).getLength(); if ( nStrLen > nMaxFuncNameLen) nMaxFuncNameLen = nStrLen; @@ -979,7 +977,7 @@ ScFunctionList::ScFunctionList() if ( pUnoAddIns->FillFunctionDesc( nFunc, *pDesc ) ) { - tmpFuncList.push_back(pDesc); + tmpFuncVector.push_back(pDesc); nStrLen = (*(pDesc->pFuncName)).getLength(); if (nStrLen > nMaxFuncNameLen) nMaxFuncNameLen = nStrLen; @@ -988,10 +986,7 @@ ScFunctionList::ScFunctionList() delete pDesc; } - //Move list to vector for better random access performance - ::std::vector<const ScFuncDesc*> tmp(tmpFuncList.begin(), tmpFuncList.end()); - tmpFuncList.clear(); - aFunctionList.swap(tmp); + aFunctionList.swap(tmpFuncVector); //Initialize iterator aFunctionListIter = aFunctionList.end(); @@ -1096,10 +1091,10 @@ ScFunctionMgr::ScFunctionMgr() : } // Fill categories with the corresponding functions (still sorted by name) - for(::std::vector<const ScFuncDesc*>::iterator iter = aCatLists[0]->begin(); iter!=aCatLists[0]->end(); ++iter) + for (auto const& elemList : *aCatLists[0]) { - if (((*iter)->nCategory) < MAX_FUNCCAT) - aCatLists[(*iter)->nCategory]->push_back(*iter); + if ((elemList->nCategory) < MAX_FUNCCAT) + aCatLists[elemList->nCategory]->push_back(elemList); } // Initialize iterators |