sc/source/core/data/documen3.cxx | 12 ++++-------- svx/source/dialog/langbox.cxx | 4 ++-- 2 files changed, 6 insertions(+), 10 deletions(-)
New commits: commit da398ad3bb511e33451f9d3bf24b0c5abd55ce25 Author: Dr. David Alan Gilbert <d...@treblig.org> AuthorDate: Wed May 24 13:57:16 2023 +0100 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Mon May 29 14:48:04 2023 +0200 replace find_if by any_of A few cases where find_if is used just to test if there are any matches; use any_of as per tdf#153109 In document3 we can merge two identical loops. In langbox we can optimise the arg capture (Arkadiy's suggestion) Change-Id: I480b80ec1b859980b651c6d727e7fb5d01d390e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152201 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 72839483dae6..b1cf5fe81b8c 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -87,10 +87,6 @@ void sortAndRemoveDuplicates(std::vector<ScTypedStrData>& rStrings, bool bCaseSe std::vector<ScTypedStrData>::iterator it = std::unique(rStrings.begin(), rStrings.end(), ScTypedStrData::EqualCaseSensitive()); rStrings.erase(it, rStrings.end()); - if (std::find_if(rStrings.begin(), rStrings.end(), - [](ScTypedStrData& rString) { return rString.IsHiddenByFilter(); }) != rStrings.end()) { - std::stable_sort(rStrings.begin(), rStrings.end(), ScTypedStrData::LessHiddenRows()); - } } else { @@ -98,10 +94,10 @@ void sortAndRemoveDuplicates(std::vector<ScTypedStrData>& rStrings, bool bCaseSe std::vector<ScTypedStrData>::iterator it = std::unique(rStrings.begin(), rStrings.end(), ScTypedStrData::EqualCaseInsensitive()); rStrings.erase(it, rStrings.end()); - if (std::find_if(rStrings.begin(), rStrings.end(), - [](ScTypedStrData& rString) { return rString.IsHiddenByFilter(); }) != rStrings.end()) { - std::stable_sort(rStrings.begin(), rStrings.end(), ScTypedStrData::LessHiddenRows()); - } + } + if (std::any_of(rStrings.begin(), rStrings.end(), + [](ScTypedStrData& rString) { return rString.IsHiddenByFilter(); })) { + std::stable_sort(rStrings.begin(), rStrings.end(), ScTypedStrData::LessHiddenRows()); } } diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx index 76d9b3de1fe5..b489ea58a546 100644 --- a/svx/source/dialog/langbox.cxx +++ b/svx/source/dialog/langbox.cxx @@ -183,8 +183,8 @@ void SvxLanguageBox::AddLanguages(const std::vector< LanguageType >& rLanguageTy weld::ComboBoxEntry aNewEntry(BuildEntry(nLang)); if (aNewEntry.sString.isEmpty()) continue; - if (std::find_if(rEntries.begin(), rEntries.end(), - [=](const weld::ComboBoxEntry& rEntry){ return rEntry.sId == aNewEntry.sId; }) != rEntries.end()) + if (std::any_of(rEntries.begin(), rEntries.end(), + [&](const weld::ComboBoxEntry& rEntry){ return rEntry.sId == aNewEntry.sId; })) continue; rEntries.push_back(aNewEntry); }