summaryrefslogtreecommitdiffstats
path: root/src/corelib/doc
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2015-07-17 15:06:22 +0200
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2015-07-17 16:35:42 +0200
commitb2603b76655ac819e43c063bb6f16bc95f358083 (patch)
tree0fbe2c367ebfffdb70e9e3f21a7cf408bafd9626 /src/corelib/doc
parent99b94aadf875c822afb6c2580e43355ac392ac92 (diff)
parent756266d01560157b7274e466b9ffc1b0e2ef9a1f (diff)
Merge remote-tracking branch 'origin/5.5' into HEAD
Conflicts: src/plugins/platforms/windows/qwindowsopengltester.cpp Change-Id: Ia7abeba9395ccf84e2fa81b91a5725a86dedb9fe
Diffstat (limited to 'src/corelib/doc')
-rw-r--r--src/corelib/doc/src/containers.qdoc7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/corelib/doc/src/containers.qdoc b/src/corelib/doc/src/containers.qdoc
index 1979c45e17..f8d0d3eb05 100644
--- a/src/corelib/doc/src/containers.qdoc
+++ b/src/corelib/doc/src/containers.qdoc
@@ -601,6 +601,13 @@
container. It only affects the copy, which is probably not what you
want.
+ An alternative to Qt's \c foreach loop is the range-based \c for that is
+ part of C++ 11 and newer. However, keep in mind that the range-based
+ \c for might force a Qt container to \l{Implicit Sharing}{detach}, whereas
+ \c foreach would not. But using \c foreach always copies the container,
+ which is usually not cheap for STL containers. If in doubt, prefer
+ \c foreach for Qt containers, and range based \c for for STL ones.
+
In addition to \c foreach, Qt also provides a \c forever
pseudo-keyword for infinite loops: