dbaccess/source/ui/browser/genericcontroller.cxx              |   10 +----
 dbaccess/source/ui/dlg/adtabdlg.cxx                           |    5 +-
 dbaccess/source/ui/querydesign/JoinController.cxx             |    2 -
 dbaccess/source/ui/querydesign/QueryTableView.cxx             |    6 +--
 dbaccess/source/ui/relationdesign/RelationTableView.cxx       |    4 +-
 desktop/source/deployment/gui/dp_gui_extlistbox.cxx           |    5 +-
 desktop/source/deployment/registry/component/dp_component.cxx |    2 -
 desktop/source/lib/init.cxx                                   |   19 ++++------
 desktop/source/lib/lokclipboard.cxx                           |    3 -
 editeng/source/editeng/editdoc.cxx                            |    2 -
 filter/source/config/cache/filterfactory.cxx                  |    6 +--
 fpicker/source/office/fileview.cxx                            |    5 +-
 framework/source/services/desktop.cxx                         |    4 --
 framework/source/services/pathsettings.cxx                    |    5 +-
 14 files changed, 30 insertions(+), 48 deletions(-)

New commits:
commit 4bbd9853afde9456c1c5bc16eca3b775e53a01fe
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Sat Nov 18 13:15:01 2023 +0100
Commit:     Julien Nabet <serval2...@yahoo.fr>
CommitDate: Sat Nov 18 18:38:36 2023 +0100

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

diff --git a/editeng/source/editeng/editdoc.cxx 
b/editeng/source/editeng/editdoc.cxx
index 9841d7854c32..7a5d70b34567 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -3009,7 +3009,7 @@ public:
 void CharAttribList::DeleteEmptyAttribs( SfxItemPool& rItemPool )
 {
     std::for_each(aAttribs.begin(), aAttribs.end(), 
RemoveEmptyAttrItem(rItemPool));
-    aAttribs.erase( std::remove_if(aAttribs.begin(), aAttribs.end(), [](const 
std::unique_ptr<EditCharAttrib>& aAttrib) { return aAttrib->IsEmpty(); } ), 
aAttribs.end() );
+    std::erase_if(aAttribs, [](const std::unique_ptr<EditCharAttrib>& aAttrib) 
{ return aAttrib->IsEmpty(); } );
     bHasEmptyAttribs = false;
 }
 
diff --git a/filter/source/config/cache/filterfactory.cxx 
b/filter/source/config/cache/filterfactory.cxx
index 481dac67a7c3..1c6fadca6c86 100644
--- a/filter/source/config/cache/filterfactory.cxx
+++ b/filter/source/config/cache/filterfactory.cxx
@@ -443,13 +443,11 @@ std::vector<OUString> 
FilterFactory::impl_getSortedFilterListForModule(const OUS
     // remove all filters from this merged list, which does not fit the flag 
specification
     if (nIFlags != -1)
     {
-        auto pItToErase = ::std::remove_if(lMergedFilters.begin(), 
lMergedFilters.end(), stlcomp_removeIfMatchFlags(pCache, nIFlags, true));
-        lMergedFilters.erase(pItToErase, lMergedFilters.end());
+        std::erase_if(lMergedFilters, stlcomp_removeIfMatchFlags(pCache, 
nIFlags, true));
     }
     if (nEFlags != -1)
     {
-        auto pItToErase = ::std::remove_if(lMergedFilters.begin(), 
lMergedFilters.end(), stlcomp_removeIfMatchFlags(pCache, nEFlags, false));
-        lMergedFilters.erase(pItToErase, lMergedFilters.end());
+        std::erase_if(lMergedFilters, stlcomp_removeIfMatchFlags(pCache, 
nEFlags, false));
     }
 
     // sort the default filter to the front of this list
diff --git a/fpicker/source/office/fileview.cxx 
b/fpicker/source/office/fileview.cxx
index ebc3ee3b8b18..1fa1c4dafcd3 100644
--- a/fpicker/source/office/fileview.cxx
+++ b/fpicker/source/office/fileview.cxx
@@ -1304,7 +1304,7 @@ void SvtFileView_Impl::FilterFolderContent_Impl( 
std::u16string_view rFilter )
 
 
     // do the filtering
-    maContent.erase(std::remove_if(maContent.begin(), maContent.end(),
+    std::erase_if(maContent,
         [&aFilters](const std::unique_ptr<SortingData_Impl>& rxContent) {
             if (rxContent->mbIsFolder)
                 return false;
@@ -1312,8 +1312,7 @@ void SvtFileView_Impl::FilterFolderContent_Impl( 
std::u16string_view rFilter )
             // 91872 - 11.09.2001 - frank.schoenh...@sun.com
             OUString sCompareString = rxContent->GetFileName(); // filter 
works on file name, not on title!
             return std::none_of(aFilters.begin(), aFilters.end(), 
FilterMatch(sCompareString));
-        }),
-        maContent.end());
+        });
 }
 
 IMPL_LINK_NOARG(SvtFileView_Impl, ChangedHdl, weld::TreeView&, void)
diff --git a/framework/source/services/desktop.cxx 
b/framework/source/services/desktop.cxx
index 35dfcd2e21eb..237d35afc6a5 100644
--- a/framework/source/services/desktop.cxx
+++ b/framework/source/services/desktop.cxx
@@ -443,9 +443,7 @@ void SAL_CALL Desktop::removeTerminateListener( const 
css::uno::Reference< css::
         }
         else if (sImplementationName == 
"com.sun.star.comp.ComponentDLLListener")
         {
-            m_xComponentDllListeners.erase(
-                    std::remove(m_xComponentDllListeners.begin(), 
m_xComponentDllListeners.end(), xListener),
-                    m_xComponentDllListeners.end());
+            std::erase(m_xComponentDllListeners, xListener);
             return;
         }
     }
diff --git a/framework/source/services/pathsettings.cxx 
b/framework/source/services/pathsettings.cxx
index 0a24b96adda7..36237e824edc 100644
--- a/framework/source/services/pathsettings.cxx
+++ b/framework/source/services/pathsettings.cxx
@@ -997,11 +997,10 @@ void 
PathSettings::impl_purgeKnownPaths(PathSettings::PathInfo& rPath,
     }
 
     // Erase items not in lList from the user path list.
-    rPath.lUserPaths.erase(std::remove_if(rPath.lUserPaths.begin(), 
rPath.lUserPaths.end(),
+    std::erase_if(rPath.lUserPaths,
         [&lList](const OUString& rItem) {
             return std::find(lList.begin(), lList.end(), rItem) == lList.end();
-        }),
-        rPath.lUserPaths.end());
+        });
 
     // Erase items in the user path list from lList.
     for (auto const& userPath : rPath.lUserPaths)
commit 6e587b15efb824c97e103d86d360c590918263c4
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Sat Nov 18 13:10:15 2023 +0100
Commit:     Julien Nabet <serval2...@yahoo.fr>
CommitDate: Sat Nov 18 18:38:23 2023 +0100

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

diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx 
b/dbaccess/source/ui/browser/genericcontroller.cxx
index 57634ec8b0d4..0d998d4ca18c 100644
--- a/dbaccess/source/ui/browser/genericcontroller.cxx
+++ b/dbaccess/source/ui/browser/genericcontroller.cxx
@@ -613,9 +613,7 @@ void OGenericUnoController::removeStatusListener(const 
Reference< XStatusListene
 {
     if (_rURL.Complete.isEmpty())
     {
-        m_arrStatusListener.erase(std::remove_if(m_arrStatusListener.begin(), 
m_arrStatusListener.end(),
-            [&aListener](const DispatchTarget& rCurrent) { return 
rCurrent.xListener == aListener; }),
-            m_arrStatusListener.end());
+        std::erase_if(m_arrStatusListener, [&aListener](const DispatchTarget& 
rCurrent) { return rCurrent.xListener == aListener; });
     }
     else
     {
@@ -641,11 +639,7 @@ void OGenericUnoController::removeStatusListener(const 
Reference< XStatusListene
 
     // now remove the listener from the deque
     std::unique_lock aGuard( m_aFeatureMutex );
-    m_aFeaturesToInvalidate.erase(
-        std::remove_if(   m_aFeaturesToInvalidate.begin(),
-                            m_aFeaturesToInvalidate.end(),
-                            FindFeatureListener(aListener))
-        ,m_aFeaturesToInvalidate.end());
+    std::erase_if( m_aFeaturesToInvalidate, FindFeatureListener(aListener));
 }
 
 void OGenericUnoController::releaseNumberForComponent()
diff --git a/dbaccess/source/ui/dlg/adtabdlg.cxx 
b/dbaccess/source/ui/dlg/adtabdlg.cxx
index 4ff90945fc6a..2d98688f5b6c 100644
--- a/dbaccess/source/ui/dlg/adtabdlg.cxx
+++ b/dbaccess/source/ui/dlg/adtabdlg.cxx
@@ -196,10 +196,9 @@ void TableListFacade::updateTableObjectList( bool 
_bAllowViews )
             const OUString* pViewEnd   = pViewBegin + sViews.getLength();
             ::comphelper::UStringMixEqual aEqualFunctor;
             for(;pViewBegin != pViewEnd;++pViewBegin)
-                aTables.erase(std::remove_if(aTables.begin(),aTables.end(),
+                std::erase_if(aTables,
                                              [&aEqualFunctor, 
pViewBegin](const OUString& lhs)
-                                             { return aEqualFunctor(lhs, 
*pViewBegin); } )
-                              , aTables.end());
+                                             { return aEqualFunctor(lhs, 
*pViewBegin); } );
             sTables = Sequence< OUString>(aTables.data(), aTables.size());
             sViews = Sequence< OUString>();
         }
diff --git a/dbaccess/source/ui/querydesign/JoinController.cxx 
b/dbaccess/source/ui/querydesign/JoinController.cxx
index 0857e0448e8b..b96615c1d80a 100644
--- a/dbaccess/source/ui/querydesign/JoinController.cxx
+++ b/dbaccess/source/ui/querydesign/JoinController.cxx
@@ -278,7 +278,7 @@ void OJoinController::SaveTabWinsPosSize( 
OJoinTableView::OTableWindowMap* pTabW
 
 void OJoinController::removeConnectionData(const 
TTableConnectionData::value_type& _pData)
 {
-    m_vTableConnectionData.erase( 
std::remove(m_vTableConnectionData.begin(),m_vTableConnectionData.end(),_pData),m_vTableConnectionData.end());
+    std::erase(m_vTableConnectionData, _pData);
 }
 
 void OJoinController::describeSupportedFeatures()
diff --git a/dbaccess/source/ui/querydesign/QueryTableView.cxx 
b/dbaccess/source/ui/querydesign/QueryTableView.cxx
index 6593c9ca1dce..bd4d6c5a9080 100644
--- a/dbaccess/source/ui/querydesign/QueryTableView.cxx
+++ b/dbaccess/source/ui/querydesign/QueryTableView.cxx
@@ -224,7 +224,7 @@ void OQueryTableView::ReSync()
             pTabWin.disposeAndClear();
             arrInvalidTables.push_back(pData->GetAliasName());
 
-            rTabWinDataList.erase( std::remove(rTabWinDataList.begin(), 
rTabWinDataList.end(), *aIter), rTabWinDataList.end());
+            std::erase(rTabWinDataList, *aIter);
             continue;
         }
 
@@ -253,7 +253,7 @@ void OQueryTableView::ReSync()
         if (bInvalid)
         {
             // no -> bad luck, no connection
-            rTabConnDataList.erase( std::remove(rTabConnDataList.begin(), 
rTabConnDataList.end(), *aConIter), rTabConnDataList.end());
+            std::erase(rTabConnDataList, *aConIter);
             continue;
         }
 
@@ -738,7 +738,7 @@ void OQueryTableView::HideTabWin( OQueryTableWindow* 
pTabWin, OQueryTabWinUndoAc
 
     // the TabWin data must also be passed out of my responsibility
     TTableWindowData& rTabWinDataList = 
m_pView->getController().getTableWindowData();
-    rTabWinDataList.erase( std::remove(rTabWinDataList.begin(), 
rTabWinDataList.end(), pTabWin->GetData()), rTabWinDataList.end());
+    std::erase(rTabWinDataList, pTabWin->GetData());
         // The data should not be destroyed as TabWin itself - which is still 
alive - needs them
         // Either it goes back into my responsibility, (via ShowTabWin), then 
I add the data back,
         // or the Undo-Action, which currently has full responsibility for the 
window
diff --git a/dbaccess/source/ui/relationdesign/RelationTableView.cxx 
b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
index 1e4f9c1c9fd9..6c96d3952047 100644
--- a/dbaccess/source/ui/relationdesign/RelationTableView.cxx
+++ b/dbaccess/source/ui/relationdesign/RelationTableView.cxx
@@ -110,7 +110,7 @@ void ORelationTableView::ReSync()
             pTabWin.disposeAndClear();
             arrInvalidTables.push_back(pData->GetTableName());
 
-            rTabWinDataList.erase( std::remove(rTabWinDataList.begin(), 
rTabWinDataList.end(), *aIter), rTabWinDataList.end());
+            std::erase(rTabWinDataList, *aIter);
             continue;
         }
 
@@ -140,7 +140,7 @@ void ORelationTableView::ReSync()
             if (bInvalid)
             {
                 // no -> bad luck, the connection is gone
-                rTabConnDataList.erase( std::remove(rTabConnDataList.begin(), 
rTabConnDataList.end(), *aConIter), rTabConnDataList.end() );
+                std::erase(rTabConnDataList, *aConIter);
                 continue;
             }
         }
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx 
b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
index 9953e0549a7b..e7f91f44abf0 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
@@ -868,12 +868,11 @@ bool ExtensionBox_Impl::FindEntryPos( const TEntry_Impl& 
rEntry, const tools::Lo
 
 void ExtensionBox_Impl::cleanVecListenerAdded()
 {
-    m_vListenerAdded.erase(std::remove_if(m_vListenerAdded.begin(), 
m_vListenerAdded.end(),
+    std::erase_if(m_vListenerAdded,
         [](const uno::WeakReference<deployment::XPackage>& rxListener) {
             const uno::Reference<deployment::XPackage> hardRef(rxListener);
             return !hardRef.is();
-        }),
-        m_vListenerAdded.end());
+        });
 }
 
 void ExtensionBox_Impl::addEventListenerOnce(
diff --git a/desktop/source/deployment/registry/component/dp_component.cxx 
b/desktop/source/deployment/registry/component/dp_component.cxx
index 635ff1af4f60..849a4784168b 100644
--- a/desktop/source/deployment/registry/component/dp_component.cxx
+++ b/desktop/source/deployment/registry/component/dp_component.cxx
@@ -989,7 +989,7 @@ void BackendImpl::removeFromUnoRc(
     const ::osl::MutexGuard guard( m_aMutex );
     unorc_verify_init( xCmdEnv );
     std::deque<OUString> & aRcItemList = getRcItemList(kind);
-    aRcItemList.erase(std::remove(aRcItemList.begin(), aRcItemList.end(), 
rcterm), aRcItemList.end());
+    std::erase(aRcItemList, rcterm);
     // write immediately:
     m_unorc_modified = true;
     unorc_flush( xCmdEnv );
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index dcdbf35b7d03..66075e3312d9 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2855,8 +2855,8 @@ static LibreOfficeKitDocument* 
lo_documentLoadWithOptions(LibreOfficeKit* pThis,
         // Serif" -> "Liberation Serif/Regular". If even one of the 
"substitutions" of a font is to
         // the same font, don't count that as a missing font.
 
-        aFontMappingUseData.erase
-            (std::remove_if(aFontMappingUseData.begin(), 
aFontMappingUseData.end(),
+        std::erase_if
+            (aFontMappingUseData,
                             [](OutputDevice::FontMappingUseItem x)
                             {
                                 // If the original font had an empty style and 
one of its
@@ -2875,15 +2875,14 @@ static LibreOfficeKitDocument* 
lo_documentLoadWithOptions(LibreOfficeKit* pThis,
                                             return true;
 
                                 return false;
-                            }),
-             aFontMappingUseData.end());
+                            });
 
         // Filter out substitutions where a proprietary font has been 
substituted by a
         // metric-compatible one. Obviously this is just a heuristic and 
implemented only for some
         // well-known cases.
 
-        aFontMappingUseData.erase
-            (std::remove_if(aFontMappingUseData.begin(), 
aFontMappingUseData.end(),
+        std::erase_if
+            (aFontMappingUseData,
                             [](OutputDevice::FontMappingUseItem x)
                             {
                                 // Again, handle only cases where the original 
font does not include
@@ -2916,8 +2915,7 @@ static LibreOfficeKitDocument* 
lo_documentLoadWithOptions(LibreOfficeKit* pThis,
                                         }
 
                                 return false;
-                            }),
-             aFontMappingUseData.end());
+                            });
 
         if (aFontMappingUseData.size() > 0)
         {
@@ -5113,8 +5111,7 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* 
pThis, const char* pComma
         aPropertyValuesVector.push_back(aValue);
 
         bool bDontSaveIfUnmodified = false;
-        
aPropertyValuesVector.erase(std::remove_if(aPropertyValuesVector.begin(),
-                                                   aPropertyValuesVector.end(),
+        std::erase_if(aPropertyValuesVector,
                                                    
[&bDontSaveIfUnmodified](const beans::PropertyValue& aItem){
                                                        if (aItem.Name == 
"DontSaveIfUnmodified")
                                                        {
@@ -5122,7 +5119,7 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* 
pThis, const char* pComma
                                                            return true;
                                                        }
                                                        return false;
-                                                   }), 
aPropertyValuesVector.end());
+                                                   });
 
         // skip saving and tell the result via UNO_COMMAND_RESULT
         if (bDontSaveIfUnmodified && (!pDocSh || !pDocSh->IsModified()))
diff --git a/desktop/source/lib/lokclipboard.cxx 
b/desktop/source/lib/lokclipboard.cxx
index 6a04f386ce17..f7d52ba466e2 100644
--- a/desktop/source/lib/lokclipboard.cxx
+++ b/desktop/source/lib/lokclipboard.cxx
@@ -131,8 +131,7 @@ void LOKClipboard::removeClipboardListener(
     const Reference<datatransfer::clipboard::XClipboardListener>& listener)
 {
     osl::ClearableMutexGuard aGuard(m_aMutex);
-    m_aListeners.erase(std::remove(m_aListeners.begin(), m_aListeners.end(), 
listener),
-                       m_aListeners.end());
+    std::erase(m_aListeners, listener);
 }
 LOKTransferable::LOKTransferable(const OUString& sMimeType,
                                  const css::uno::Sequence<sal_Int8>& aSequence)

Reply via email to