From 6e587b15efb824c97e103d86d360c590918263c4 Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Sat, 18 Nov 2023 13:10:15 +0100 Subject: 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 --- 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 ++-- 5 files changed, 10 insertions(+), 17 deletions(-) (limited to 'dbaccess') 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; } } -- cgit