From 2d4295f16761a0e47b5218bbb1db5c14d16ce4fe Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Mon, 30 Nov 2015 12:19:31 +0100 Subject: QGraphicsView: replace some Q_FOREACH loops over const locals with C++11 range-for This needs to be handled a bit carefully, because Qt containers will detach upon being iterated over using range-for. In the cases of this patch, that cannot happen, because all containers are local and marked as const (either by this patch or before). Separate patches will deal with other situations. Range-for loops are much more efficient than foreach loops. This patch shaves ~1.8KiB of text size off an optimized Linux AMD64 GCC 4.9 build. Change-Id: I5c58658937ac4323594161bf94a2fce3c5667914 Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp') diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp index adc77ded47..e8501474a5 100644 --- a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp @@ -2588,7 +2588,7 @@ void QGraphicsAnchorLayoutPrivate::identifyFloatItems(const QSet & { QSet nonFloating; - foreach (const AnchorData *ad, visited) + for (const AnchorData *ad : visited) identifyNonFloatItems_helper(ad, &nonFloating); QSet allItems; -- cgit v1.2.3