summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-12-15 20:37:59 +0100
committerMarc Mutz <marc.mutz@kdab.com>2015-12-16 17:42:21 +0000
commitf2d8d9daee9ecb046750bd340288b8d3da2224ed (patch)
treeda4a1ca5eb151b2fe269b39597e960078133cbeb /src
parent2cc2bcca94aa1f20b7739eb120f9070508379825 (diff)
QGraphicsAnchorLayout: replace a Q_FOREACH with std::accumulate
Saves ~0.5KiB in text size on optimized Linux AMD64 GCC 4.9 builds. Change-Id: Iba2c02eed44f1ee3521bc49fe7afae9c2e916fdc Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
index 0caff6c678..1c63ed5243 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -42,6 +42,7 @@
#include <QtCore/qfile.h>
#endif
+#include <numeric>
#ifndef QT_NO_GRAPHICSVIEW
QT_BEGIN_NAMESPACE
@@ -2180,10 +2181,7 @@ static void shiftConstraints(const QList<QSimplexConstraint *> &constraints, qre
{
for (int i = 0; i < constraints.count(); ++i) {
QSimplexConstraint *c = constraints.at(i);
- qreal multiplier = 0;
- foreach (qreal v, c->variables) {
- multiplier += v;
- }
+ const qreal multiplier = std::accumulate(c->variables.cbegin(), c->variables.cend(), qreal(0));
c->constant += multiplier * amount;
}
}