From 17df4bf52847cb38765a6318d411218ecee84c08 Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Sun, 21 May 2023 22:15:43 +0300 Subject: [PATCH] Moc: use a std::initializer_list instead of copying No need to copy the 3 QLists to iterate over them. Change-Id: Id0fc7d39012bdaa78e51b1153565df77c7fb889a Reviewed-by: Thiago Macieira Reviewed-by: Fabian Kosmale --- src/tools/moc/generator.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 128da4fd01..f295235c1c 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -539,9 +539,9 @@ void Generator::generateCode() // metatypes for all exposed methods // because we definitely printed something above, this section doesn't need comma control - for (const QList &methodContainer : - { cdef->signalList, cdef->slotList, cdef->methodList }) { - for (const FunctionDef &fdef : methodContainer) { + const auto allMethods = {&cdef->signalList, &cdef->slotList, &cdef->methodList}; + for (const QList *methodContainer : allMethods) { + for (const FunctionDef &fdef : *methodContainer) { fprintf(out, ",\n // method '%s'\n %s", fdef.name.constData(), stringForType(fdef.type.name, false).constData()); for (const auto &argument: fdef.arguments)