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

Change-Id: I2a72422a6c8185d17876daac41a86137048b034c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159627
Tested-by: Jenkins
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
This commit is contained in:
Julien Nabet 2023-11-18 15:13:57 +01:00
parent 4aa5e93a80
commit e08efe99cd
3 changed files with 6 additions and 12 deletions

View File

@ -498,8 +498,7 @@ void OXUndoEnvironment::RemoveSection(const Reference< report::XSection > & _xSe
try
{
uno::Reference<container::XChild> xChild(_xSection);
m_pImpl->m_aSections.erase(::std::remove(m_pImpl->m_aSections.begin(),m_pImpl->m_aSections.end(),
xChild), m_pImpl->m_aSections.end());
std::erase(m_pImpl->m_aSections, xChild);
Reference< XInterface > xInt(_xSection);
RemoveElement(xInt);
}

View File

@ -166,8 +166,7 @@ void OXReportControllerObserver::RemoveSection(const uno::Reference< report::XSe
try
{
uno::Reference<container::XChild> xChild(_xSection);
m_aSections.erase(::std::remove(m_aSections.begin(), m_aSections.end(),
xChild), m_aSections.end());
std::erase(m_aSections, xChild);
uno::Reference< uno::XInterface > xInt(_xSection);
RemoveElement(xInt);
}

View File

@ -116,13 +116,11 @@ private:
std::sort(env_container.begin(), env_container.end());
if (RUNNING_ON_VALGRIND)
{
env_container.erase(
std::remove_if(
env_container.begin(), env_container.end(),
std::erase_if(
env_container,
[](OString const & s) {
return s.startsWith("LD_PRELOAD=")
|| s.startsWith("VALGRIND_LIB="); }),
env_container.end());
|| s.startsWith("VALGRIND_LIB="); });
}
}
}
@ -245,9 +243,7 @@ public:
//remove the environment variables that we have changed
//in the child environment from the read parent environment
parent_env.erase(
std::remove_if(parent_env.begin(), parent_env.end(), exclude(different_env_vars)),
parent_env.end());
std::erase_if(parent_env, exclude(different_env_vars));
for (auto& env : parent_env)
std::cout << "stripped parent env: " << env << "\n";