From e08efe99cdb8d2159b2714d0f23e62678348eaed Mon Sep 17 00:00:00 2001 From: Julien Nabet Date: Sat, 18 Nov 2023 15:13:57 +0100 Subject: [PATCH] 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 --- reportdesign/source/core/sdr/UndoEnv.cxx | 3 +-- .../source/ui/report/ReportControllerObserver.cxx | 3 +-- sal/qa/osl/process/osl_process.cxx | 12 ++++-------- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/reportdesign/source/core/sdr/UndoEnv.cxx b/reportdesign/source/core/sdr/UndoEnv.cxx index b64e5451b566..bba8d5ae91f1 100644 --- a/reportdesign/source/core/sdr/UndoEnv.cxx +++ b/reportdesign/source/core/sdr/UndoEnv.cxx @@ -498,8 +498,7 @@ void OXUndoEnvironment::RemoveSection(const Reference< report::XSection > & _xSe try { uno::Reference 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); } diff --git a/reportdesign/source/ui/report/ReportControllerObserver.cxx b/reportdesign/source/ui/report/ReportControllerObserver.cxx index b05d3b3d1359..d693c1787116 100644 --- a/reportdesign/source/ui/report/ReportControllerObserver.cxx +++ b/reportdesign/source/ui/report/ReportControllerObserver.cxx @@ -166,8 +166,7 @@ void OXReportControllerObserver::RemoveSection(const uno::Reference< report::XSe try { uno::Reference 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); } diff --git a/sal/qa/osl/process/osl_process.cxx b/sal/qa/osl/process/osl_process.cxx index e648d2467984..cab3bffd2d17 100644 --- a/sal/qa/osl/process/osl_process.cxx +++ b/sal/qa/osl/process/osl_process.cxx @@ -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";