summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2023-11-18 13:10:15 +0100
committerJulien Nabet <serval2412@yahoo.fr>2023-11-18 18:38:23 +0100
commit6e587b15efb824c97e103d86d360c590918263c4 (patch)
tree63be09de7f4419b5b174f4e0bdac48d0d2066d69 /desktop
parentc05595d2420b92a428b45cfaf65a3adf88fd8bed (diff)
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 <serval2412@yahoo.fr>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/deployment/gui/dp_gui_extlistbox.cxx5
-rw-r--r--desktop/source/deployment/registry/component/dp_component.cxx2
-rw-r--r--desktop/source/lib/init.cxx19
-rw-r--r--desktop/source/lib/lokclipboard.cxx3
4 files changed, 12 insertions, 17 deletions
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
index 9953e0549a7b..e7f91f44abf0 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
@@ -868,12 +868,11 @@ bool ExtensionBox_Impl::FindEntryPos( const TEntry_Impl& rEntry, const tools::Lo
void ExtensionBox_Impl::cleanVecListenerAdded()
{
- m_vListenerAdded.erase(std::remove_if(m_vListenerAdded.begin(), m_vListenerAdded.end(),
+ std::erase_if(m_vListenerAdded,
[](const uno::WeakReference<deployment::XPackage>& rxListener) {
const uno::Reference<deployment::XPackage> hardRef(rxListener);
return !hardRef.is();
- }),
- m_vListenerAdded.end());
+ });
}
void ExtensionBox_Impl::addEventListenerOnce(
diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx
index 635ff1af4f60..849a4784168b 100644
--- a/desktop/source/deployment/registry/component/dp_component.cxx
+++ b/desktop/source/deployment/registry/component/dp_component.cxx
@@ -989,7 +989,7 @@ void BackendImpl::removeFromUnoRc(
const ::osl::MutexGuard guard( m_aMutex );
unorc_verify_init( xCmdEnv );
std::deque<OUString> & aRcItemList = getRcItemList(kind);
- aRcItemList.erase(std::remove(aRcItemList.begin(), aRcItemList.end(), rcterm), aRcItemList.end());
+ std::erase(aRcItemList, rcterm);
// write immediately:
m_unorc_modified = true;
unorc_flush( xCmdEnv );
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index dcdbf35b7d03..66075e3312d9 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2855,8 +2855,8 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis,
// Serif" -> "Liberation Serif/Regular". If even one of the "substitutions" of a font is to
// the same font, don't count that as a missing font.
- aFontMappingUseData.erase
- (std::remove_if(aFontMappingUseData.begin(), aFontMappingUseData.end(),
+ std::erase_if
+ (aFontMappingUseData,
[](OutputDevice::FontMappingUseItem x)
{
// If the original font had an empty style and one of its
@@ -2875,15 +2875,14 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis,
return true;
return false;
- }),
- aFontMappingUseData.end());
+ });
// Filter out substitutions where a proprietary font has been substituted by a
// metric-compatible one. Obviously this is just a heuristic and implemented only for some
// well-known cases.
- aFontMappingUseData.erase
- (std::remove_if(aFontMappingUseData.begin(), aFontMappingUseData.end(),
+ std::erase_if
+ (aFontMappingUseData,
[](OutputDevice::FontMappingUseItem x)
{
// Again, handle only cases where the original font does not include
@@ -2916,8 +2915,7 @@ static LibreOfficeKitDocument* lo_documentLoadWithOptions(LibreOfficeKit* pThis,
}
return false;
- }),
- aFontMappingUseData.end());
+ });
if (aFontMappingUseData.size() > 0)
{
@@ -5113,8 +5111,7 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma
aPropertyValuesVector.push_back(aValue);
bool bDontSaveIfUnmodified = false;
- aPropertyValuesVector.erase(std::remove_if(aPropertyValuesVector.begin(),
- aPropertyValuesVector.end(),
+ std::erase_if(aPropertyValuesVector,
[&bDontSaveIfUnmodified](const beans::PropertyValue& aItem){
if (aItem.Name == "DontSaveIfUnmodified")
{
@@ -5122,7 +5119,7 @@ static void doc_postUnoCommand(LibreOfficeKitDocument* pThis, const char* pComma
return true;
}
return false;
- }), aPropertyValuesVector.end());
+ });
// skip saving and tell the result via UNO_COMMAND_RESULT
if (bDontSaveIfUnmodified && (!pDocSh || !pDocSh->IsModified()))
diff --git a/desktop/source/lib/lokclipboard.cxx b/desktop/source/lib/lokclipboard.cxx
index 6a04f386ce17..f7d52ba466e2 100644
--- a/desktop/source/lib/lokclipboard.cxx
+++ b/desktop/source/lib/lokclipboard.cxx
@@ -131,8 +131,7 @@ void LOKClipboard::removeClipboardListener(
const Reference<datatransfer::clipboard::XClipboardListener>& listener)
{
osl::ClearableMutexGuard aGuard(m_aMutex);
- m_aListeners.erase(std::remove(m_aListeners.begin(), m_aListeners.end(), listener),
- m_aListeners.end());
+ std::erase(m_aListeners, listener);
}
LOKTransferable::LOKTransferable(const OUString& sMimeType,
const css::uno::Sequence<sal_Int8>& aSequence)