vcl/source/gdi/impglyphitem.cxx   |   11 +++++------
 vcl/source/pdf/pdfwriter_impl.cxx |    7 ++-----
 vcl/source/window/accmgr.cxx      |    7 +++----
 3 files changed, 10 insertions(+), 15 deletions(-)

New commits:
commit d24600ada38a88e88e1ae412dee7bc1f1f57b9ed
Author:     Teodora Stefan <[email protected]>
AuthorDate: Thu Dec 4 00:48:50 2025 +0200
Commit:     Mike Kaganski <[email protected]>
CommitDate: Fri Mar 6 05:23:55 2026 +0100

    tdf#153109 Use all_of and any_of from STD instead of looping
    
    Change-Id: I162ba67e2101bcb025622c24ad685d3086fe7371
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194968
    Reviewed-by: Mike Kaganski <[email protected]>
    Tested-by: Jenkins

diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx
index d0dc64e3aa19..efc8e9f3c049 100644
--- a/vcl/source/gdi/impglyphitem.cxx
+++ b/vcl/source/gdi/impglyphitem.cxx
@@ -17,8 +17,9 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
-#include <impglyphitem.hxx>
+#include <algorithm>
 #include <utility>
+#include <impglyphitem.hxx>
 #include <vcl/glyphitemcache.hxx>
 #include <vcl/outdev.hxx>
 #include <vcl/vcllayout.hxx>
@@ -59,11 +60,9 @@ bool SalLayoutGlyphs::IsValid() const
         return false;
     if (!m_pImpl->IsValid())
         return false;
-    if (m_pExtraImpls)
-        for (std::unique_ptr<SalLayoutGlyphsImpl> const& impl : *m_pExtraImpls)
-            if (!impl->IsValid())
-                return false;
-    return true;
+
+    return !m_pExtraImpls
+           || std::ranges::all_of(*m_pExtraImpls, [](const auto& impl) { 
return impl->IsValid(); });
 }
 
 void SalLayoutGlyphs::Invalidate()
diff --git a/vcl/source/pdf/pdfwriter_impl.cxx 
b/vcl/source/pdf/pdfwriter_impl.cxx
index d04618aaa4e0..0650419fa9ae 100644
--- a/vcl/source/pdf/pdfwriter_impl.cxx
+++ b/vcl/source/pdf/pdfwriter_impl.cxx
@@ -1272,11 +1272,8 @@ sal_Int32 PDFWriterImpl::emitStructure( 
PDFStructureElement& rEle )
 
 bool PDFWriterImpl::emitGradients()
 {
-    for (auto const& gradient : m_aGradients)
-    {
-        if ( !writeGradientFunction( gradient ) ) return false;
-    }
-    return true;
+    return std::all_of(m_aGradients.begin(), m_aGradients.end(),
+                       [this](const auto& gradient) { return 
writeGradientFunction(gradient); });
 }
 
 bool PDFWriterImpl::emitTilings()
diff --git a/vcl/source/window/accmgr.cxx b/vcl/source/window/accmgr.cxx
index 26ea9846e8dc..10491d8a03cc 100644
--- a/vcl/source/window/accmgr.cxx
+++ b/vcl/source/window/accmgr.cxx
@@ -32,10 +32,9 @@ bool ImplAccelManager::InsertAccel( Accelerator* pAccel )
     if ( !mxAccelList ) {
         mxAccelList.emplace();
     } else {
-        for (Accelerator* i : *mxAccelList) {
-            if ( i == pAccel ) {
-                return false;
-            }
+        if (std::ranges::find(*mxAccelList, pAccel) != mxAccelList->end())
+        {
+            return false;
         }
     }
 

Reply via email to