sd/source/console/PresenterAccessibility.cxx                    |    6 +-----
 sd/source/core/cusshow.cxx                                      |    2 +-
 sd/source/ui/framework/configuration/ResourceFactoryManager.cxx |    9 
+++------
 sd/source/ui/view/outlview.cxx                                  |   10 
++++------
 sfx2/source/dialog/StyleList.cxx                                |    5 +----
 sfx2/source/doc/Metadatable.cxx                                 |    2 +-
 sfx2/source/doc/sfxbasemodel.cxx                                |    2 +-
 7 files changed, 12 insertions(+), 24 deletions(-)

New commits:
commit 0c13d8b8d97666a4e23fc93601a0ced141434d78
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Sat Nov 18 22:42:37 2023 +0100
Commit:     Julien Nabet <serval2...@yahoo.fr>
CommitDate: Sun Nov 19 09:49:01 2023 +0100

    c++20: use std::erase(_if) instead of std::remove(_if)+erase (part 10)
    
    Change-Id: I7681a3ed5af058cf4356509d54a2195e6d4833e1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159641
    Tested-by: Jenkins
    Reviewed-by: Julien Nabet <serval2...@yahoo.fr>

diff --git a/sfx2/source/dialog/StyleList.cxx b/sfx2/source/dialog/StyleList.cxx
index b9f9c0c62237..7e7cd347e429 100644
--- a/sfx2/source/dialog/StyleList.cxx
+++ b/sfx2/source/dialog/StyleList.cxx
@@ -665,10 +665,7 @@ static void MakeTree_Impl(StyleTreeArr_Impl& rArr, const 
OUString& aUIName)
     }
 
     // Only keep tree roots in rArr, child elements can be accessed through 
the hierarchy
-    rArr.erase(
-        std::remove_if(rArr.begin(), rArr.end(),
-                       [](std::unique_ptr<StyleTree_Impl> const& pEntry) { 
return !pEntry; }),
-        rArr.end());
+    std::erase_if(rArr, [](std::unique_ptr<StyleTree_Impl> const& pEntry) { 
return !pEntry; });
 
     // tdf#91106 sort top level styles
     std::sort(rArr.begin(), rArr.end());
diff --git a/sfx2/source/doc/Metadatable.cxx b/sfx2/source/doc/Metadatable.cxx
index b10cc35cafa7..0952b3617739 100644
--- a/sfx2/source/doc/Metadatable.cxx
+++ b/sfx2/source/doc/Metadatable.cxx
@@ -488,7 +488,7 @@ rmIter(XmlIdMap_t & i_rXmlIdMap, XmlIdMap_t::iterator 
const& i_rIter,
     {
         XmlIdVector_t & rVector( isContentFile(i_rStream)
             ? i_rIter->second.first : i_rIter->second.second );
-        rVector.erase(std::remove(rVector.begin(), rVector.end(), 
&const_cast<Metadatable&>(i_rObject)), rVector.end());
+        std::erase(rVector, &const_cast<Metadatable&>(i_rObject));
         if (i_rIter->second.first.empty() && i_rIter->second.second.empty())
         {
             i_rXmlIdMap.erase(i_rIter);
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 52436ef8d4d6..860bea828122 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -1233,7 +1233,7 @@ void SAL_CALL SfxBaseModel::disconnectController( const 
Reference< frame::XContr
         return;
 
     auto& vec = m_pData->m_seqControllers;
-    vec.erase(std::remove(vec.begin(), vec.end(), xController), vec.end());
+    std::erase(vec, xController);
 
     if ( xController == m_pData->m_xCurrent )
         m_pData->m_xCurrent.clear();
commit 0d84174d8c205a58fa1a64d44ae5629c40a9cf85
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Sat Nov 18 22:33:50 2023 +0100
Commit:     Julien Nabet <serval2...@yahoo.fr>
CommitDate: Sun Nov 19 09:48:48 2023 +0100

    c++20: use std::erase(_if) instead of std::remove(_if)+erase (part 9)
    
    Change-Id: I61e53faf68e7e0fab2052122993197c7994441ff
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159640
    Tested-by: Jenkins
    Reviewed-by: Julien Nabet <serval2...@yahoo.fr>

diff --git a/sd/source/console/PresenterAccessibility.cxx 
b/sd/source/console/PresenterAccessibility.cxx
index 4f2fa33f3866..e7ac0b95d52b 100644
--- a/sd/source/console/PresenterAccessibility.cxx
+++ b/sd/source/console/PresenterAccessibility.cxx
@@ -970,11 +970,7 @@ void SAL_CALL 
PresenterAccessible::AccessibleObject::removeAccessibleEventListen
     {
         const osl::MutexGuard aGuard(m_aMutex);
 
-        auto const it(std::remove(maListeners.begin(), maListeners.end(), 
rxListener));
-        if (it != maListeners.end())
-        {
-            maListeners.erase(it);
-        }
+        std::erase(maListeners, rxListener);
     }
 }
 
diff --git a/sd/source/core/cusshow.cxx b/sd/source/core/cusshow.cxx
index 8b51a613da45..7d9bf6e7caf6 100644
--- a/sd/source/core/cusshow.cxx
+++ b/sd/source/core/cusshow.cxx
@@ -80,7 +80,7 @@ void SdCustomShow::ReplacePage( const SdPage* pOldPage, const 
SdPage* pNewPage )
 {
     if( !pNewPage )
     {
-        maPages.erase(::std::remove(maPages.begin(), maPages.end(), pOldPage), 
maPages.end());
+        std::erase(maPages, pOldPage);
     }
     else
     {
diff --git a/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx 
b/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx
index 122d5619893f..fd07caeda493 100644
--- a/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx
+++ b/sd/source/ui/framework/configuration/ResourceFactoryManager.cxx
@@ -134,12 +134,9 @@ void ResourceFactoryManager::RemoveFactoryForReference(
 
     // Remove the pattern entries whose factories are identical to the given
     // factory.
-    maFactoryPatternList.erase(
-        std::remove_if(
-            maFactoryPatternList.begin(),
-            maFactoryPatternList.end(),
-            [&] (FactoryPatternList::value_type const& it) { return it.second 
== rxFactory; }),
-        maFactoryPatternList.end());
+    std::erase_if(
+            maFactoryPatternList,
+            [&] (FactoryPatternList::value_type const& it) { return it.second 
== rxFactory; });
 }
 
 Reference<XResourceFactory> ResourceFactoryManager::GetFactory (
diff --git a/sd/source/ui/view/outlview.cxx b/sd/source/ui/view/outlview.cxx
index 2f68a6f8d9d2..d424f0117c27 100644
--- a/sd/source/ui/view/outlview.cxx
+++ b/sd/source/ui/view/outlview.cxx
@@ -760,9 +760,8 @@ IMPL_LINK( OutlineView, BeginMovingHdl, ::Outliner *, 
pOutliner, void )
     // list of selected title paragraphs
     mpOutlinerViews[0]->CreateSelectionList(maSelectedParas);
 
-    maSelectedParas.erase(std::remove_if(maSelectedParas.begin(), 
maSelectedParas.end(),
-        [](const Paragraph* pPara) { return !Outliner::HasParaFlag(pPara, 
ParaFlag::ISPAGE); }),
-        maSelectedParas.end());
+    std::erase_if(maSelectedParas,
+        [](const Paragraph* pPara) { return !Outliner::HasParaFlag(pPara, 
ParaFlag::ISPAGE); });
 
     // select the pages belonging to the paragraphs on level 0 to select
     sal_uInt16 nPos = 0;
@@ -1229,9 +1228,8 @@ void OutlineView::SetSelectedPages()
     std::vector<Paragraph*> aSelParas;
     mpOutlinerViews[0]->CreateSelectionList(aSelParas);
 
-    aSelParas.erase(std::remove_if(aSelParas.begin(), aSelParas.end(),
-        [](const Paragraph* pPara) { return !Outliner::HasParaFlag(pPara, 
ParaFlag::ISPAGE); }),
-        aSelParas.end());
+    std::erase_if(aSelParas,
+        [](const Paragraph* pPara) { return !Outliner::HasParaFlag(pPara, 
ParaFlag::ISPAGE); });
 
     // select the pages belonging to the paragraphs on level 0 to select
     sal_uInt16 nPos = 0;

Reply via email to