summaryrefslogtreecommitdiff
path: root/sc/source/core
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2021-05-24 17:15:32 +0200
committerJulien Nabet <serval2412@yahoo.fr>2021-05-24 20:59:25 +0200
commit706d423bb12c79f0e6c71b7e38d092d1bdf1c259 (patch)
treede48e8f078279c5631f0a29c6ab50b4a60d3a0d1 /sc/source/core
parentdc657964f1674c7ba36c3e844968ac97c7848433 (diff)
Teach ScOutlineCollection to return an iterator when calling erase, then use it
Hoping C++11 erase method std::map which returns an iterator is now known for compiler of every env. Change-Id: Ie4f87ce234228209257f7025e197fdf53ea7e69d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116066 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Jenkins
Diffstat (limited to 'sc/source/core')
-rw-r--r--sc/source/core/data/olinetab.cxx24
1 files changed, 5 insertions, 19 deletions
diff --git a/sc/source/core/data/olinetab.cxx b/sc/source/core/data/olinetab.cxx
index ddcc4c4ed6ad..13fc17a7b35f 100644
--- a/sc/source/core/data/olinetab.cxx
+++ b/sc/source/core/data/olinetab.cxx
@@ -126,9 +126,9 @@ ScOutlineCollection::const_iterator ScOutlineCollection::end() const
return m_Entries.end();
}
-void ScOutlineCollection::erase(const iterator& pos)
+ScOutlineCollection::iterator ScOutlineCollection::erase(const iterator& pos)
{
- m_Entries.erase(pos);
+ return m_Entries.erase(pos);
}
bool ScOutlineCollection::empty() const
@@ -262,11 +262,7 @@ bool ScOutlineArray::Insert(
return false;
}
aCollections[nMoveLevel+1].insert(*pEntry);
- size_t nPos = std::distance(rColl.begin(), it);
- rColl.erase(it);
- it = rColl.begin();
- std::advance(it, nPos);
- itEnd = rColl.end();
+ it = rColl.erase(it);
if (nMoveLevel == nDepth - 1)
bNeedSize = true;
}
@@ -345,12 +341,7 @@ void ScOutlineArray::PromoteSub(SCCOLROW nStartPos, SCCOLROW nEndPos, size_t nSt
{
aCollections[nLevel-1].insert(*pEntry);
- // Re-calc iterator positions after the tree gets invalidated
- size_t nPos = std::distance(rColl.begin(), it);
- rColl.erase(it);
- it = rColl.begin();
- std::advance(it, nPos);
- itEnd = rColl.end();
+ it = rColl.erase(it);
}
else
++it;
@@ -368,12 +359,7 @@ void ScOutlineArray::PromoteSub(SCCOLROW nStartPos, SCCOLROW nEndPos, size_t nSt
{
aCollections[nLevel-1].insert(*pEntry);
- // Re-calc iterator positions after the tree gets invalidated
- size_t nPos = std::distance(rColl.begin(), it);
- rColl.erase(it);
- it = rColl.begin();
- std::advance(it, nPos);
- itEnd = rColl.end();
+ it = rColl.erase(it);
}
else
++it;