From 8419b56097bd08e0c5d07b47ccd149f2d19a9d24 Mon Sep 17 00:00:00 2001 From: Anton Kudryavtsev Date: Mon, 2 Oct 2023 18:59:26 +0300 Subject: [PATCH] qFindChar: pass char16_t by value Cheaply-copied types should be passed by value according to https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-in Change-Id: I341193c0a65931c1406fc7d711ef74d763178dee Reviewed-by: Thiago Macieira --- src/corelib/text/qstring.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/text/qstring.cpp b/src/corelib/text/qstring.cpp index 64ceb100ce2..ca81384af80 100644 --- a/src/corelib/text/qstring.cpp +++ b/src/corelib/text/qstring.cpp @@ -150,7 +150,7 @@ static inline qsizetype qFindChar(QStringView str, QChar ch, qsizetype from, Qt: return n - s; } else { c = foldCase(c); - auto it = std::find_if(n, e, [c](const auto &ch) { return foldAndCompare(ch, c); }); + auto it = std::find_if(n, e, [c](auto ch) { return foldAndCompare(ch, c); }); if (it != e) return std::distance(s, it); }