c++20: use std::erase(_if) instead of std::remove(_if)+erase (svl)

Change-Id: I572a7c81130f15929536c3c334875e8401be9e60
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159700
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
This commit is contained in:
Julien Nabet 2023-11-19 20:51:08 +01:00
parent 7c4dba1def
commit 693735e4d3
3 changed files with 3 additions and 9 deletions

View file

@ -50,10 +50,7 @@ namespace svt
return;
// first, check which of the objects we hold in s_aHistory can be removed
_rHistory.erase(std::remove_if(_rHistory.begin(),
_rHistory.end(),
[](const css::uno::WeakReference< XInterface > & x) { return !x.get().is(); }),
_rHistory.end());
std::erase_if(_rHistory, [](const css::uno::WeakReference< XInterface > & x) { return !x.get().is(); });
// then push_back the picker
_rHistory.emplace_back( _rxPicker );

View file

@ -87,9 +87,7 @@ void SvtBroadcaster::Normalize() const
// clear empty slots first, because then we often have to do very little sorting
if (mnEmptySlots)
{
maListeners.erase(
std::remove_if(maListeners.begin(), maListeners.end(), [] (SvtListener* p) { return isDeletedPtr(p); }),
maListeners.end());
std::erase_if(maListeners, [] (SvtListener* p) { return isDeletedPtr(p); });
mnEmptySlots = 0;
}

View file

@ -256,8 +256,7 @@ DdeTransaction::~DdeTransaction()
}
delete pName;
rDde.aTransactions.erase(std::remove(rDde.aTransactions.begin(),
rDde.aTransactions.end(),this));
std::erase(rDde.aTransactions,this);
}
void DdeTransaction::Execute()