tdf#153109 Use any_of instead of loop to check a range
Change-Id: Icf65288a7e53257008129b71e8d716b0b0c7f5fa Reviewed-on: https://gerrit.libreoffice.org/c/core/+/152868 Tested-by: Paris Oplopoios <parisoplop@gmail.com> Reviewed-by: Paris Oplopoios <parisoplop@gmail.com>
This commit is contained in:
parent
cf0fe26f95
commit
81e815edbf
3 changed files with 7 additions and 16 deletions
|
@ -19,6 +19,7 @@
|
|||
#include <string_view>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#include <com/sun/star/container/NoSuchElementException.hpp>
|
||||
#include <com/sun/star/lang/IllegalArgumentException.hpp>
|
||||
|
@ -1723,12 +1724,8 @@ bool Enumeration::matches(css::uno::TypeClass tc) const {
|
|||
if (!types_.hasElements()) {
|
||||
return true;
|
||||
}
|
||||
for (const auto & i : types_) {
|
||||
if (i == tc) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
return std::any_of(types_.begin(), types_.end(), [&tc](const auto& i) { return i == tc; });
|
||||
}
|
||||
|
||||
void Enumeration::findNextMatch() {
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
#include <memory>
|
||||
#include <utility>
|
||||
#include <algorithm>
|
||||
#include <string_view>
|
||||
#include <sal/config.h>
|
||||
|
||||
|
@ -175,10 +176,7 @@ static bool lcl_IsSymbolChar( CharClass const & rCC, const OUString& rTxt,
|
|||
|
||||
static bool lcl_IsInArr(std::u16string_view arr, const sal_uInt32 c)
|
||||
{
|
||||
for (const auto c1 : arr)
|
||||
if (c1 == c)
|
||||
return true;
|
||||
return false;
|
||||
return std::any_of(arr.begin(), arr.end(), [c](const auto c1) { return c1 == c; });
|
||||
}
|
||||
|
||||
SvxAutoCorrDoc::~SvxAutoCorrDoc()
|
||||
|
|
|
@ -3789,12 +3789,8 @@ EscherPersistTable::~EscherPersistTable()
|
|||
|
||||
bool EscherPersistTable::PtIsID( sal_uInt32 nID )
|
||||
{
|
||||
for(auto const & pPtr : maPersistTable) {
|
||||
if ( pPtr->mnID == nID ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return std::any_of(maPersistTable.begin(), maPersistTable.end(),
|
||||
[&nID](const auto& rxEntry) { return rxEntry->mnID == nID; });
|
||||
}
|
||||
|
||||
void EscherPersistTable::PtInsert( sal_uInt32 nID, sal_uInt32 nOfs )
|
||||
|
|
Loading…
Reference in a new issue