linguistic/source/spelldsp.cxx |    9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

New commits:
commit 67444270826e17b8ae7b38b7519365b34dde5601
Author:     Simon Chenery <simon_chen...@yahoo.com>
AuthorDate: Sat Jan 25 20:16:48 2025 +0100
Commit:     Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>
CommitDate: Tue Jan 28 07:04:37 2025 +0100

    tdf#153109 Use any_of to check for match in spelldsp.cxx
    
    Change-Id: If9bf5d96dea0dc5939c951a29f893d5fb02003d8
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180751
    Tested-by: Jenkins
    Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org>

diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx
index eb15cf3be923..a8c20748bbab 100644
--- a/linguistic/source/spelldsp.cxx
+++ b/linguistic/source/spelldsp.cxx
@@ -81,15 +81,10 @@ void ProposalList::Prepend( const OUString &rText )
 
 void ProposalList::Append( const OUString &rOrig, bool bPrepend )
 {
-    bool bFound = false;
     // convert ASCII apostrophe to the typographic one
     const OUString aText( rOrig.indexOf( '\'' ) > -1 ? rOrig.replace('\'', 
u'’') : rOrig );
-    size_t nCnt = aVec.size();
-    for (size_t i = 0;  !bFound && i < nCnt;  ++i)
-    {
-        if (aVec[i] == aText)
-            bFound = true;
-    }
+    const bool bFound = std::any_of(aVec.begin(), aVec.end(),
+        [&aText](const OUString& n){ return n == aText; });
     if (!bFound)
     {
         if ( bPrepend )

Reply via email to