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 try
{ {
uno::Reference<container::XChild> xChild(_xSection); uno::Reference<container::XChild> xChild(_xSection);
m_pImpl->m_aSections.erase(::std::remove(m_pImpl->m_aSections.begin(),m_pImpl->m_aSections.end(), std::erase(m_pImpl->m_aSections, xChild);
xChild), m_pImpl->m_aSections.end());
Reference< XInterface > xInt(_xSection); Reference< XInterface > xInt(_xSection);
RemoveElement(xInt); RemoveElement(xInt);
} }

View File

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

View File

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