diff options
author | Ahmad Samir <a.samirh78@gmail.com> | 2023-08-11 18:11:04 +0300 |
---|---|---|
committer | Ahmad Samir <a.samirh78@gmail.com> | 2023-08-19 16:29:54 +0300 |
commit | 9aeb38650d60857b949a130619f0ba32d52df923 (patch) | |
tree | 004068d42eadb7d4125a15192e2ffb98bf75e999 | |
parent | 964e6c675422957483128452331721ff03b25eff (diff) |
tst_QFreeList: build with QT_NO_FOREACH
The container is local to the function, but can't be made const due to
the way it's filled. The loop clearly doesn't modify the container so
use std::as_const and ranged-for.
Task-number: QTBUG-115839
Change-Id: Ia9f01dfaccfca3225fe0487aafd0a386605cf466
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-rw-r--r-- | tests/auto/corelib/tools/qfreelist/tst_qfreelist.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/tests/auto/corelib/tools/qfreelist/tst_qfreelist.cpp b/tests/auto/corelib/tools/qfreelist/tst_qfreelist.cpp index 827d1e56fd..680749938f 100644 --- a/tests/auto/corelib/tools/qfreelist/tst_qfreelist.cpp +++ b/tests/auto/corelib/tools/qfreelist/tst_qfreelist.cpp @@ -1,8 +1,6 @@ // Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 -#undef QT_NO_FOREACH // this file contains unported legacy Q_FOREACH uses - #include <QtCore/QCoreApplication> #include <QtCore/QElapsedTimer> #include <QtCore/QList> @@ -117,7 +115,7 @@ public: needToRelease << i; } while (t.elapsed() < TimeLimit); - foreach (int x, needToRelease) + for (int x : std::as_const(needToRelease)) freelist.release(x); } }; |