summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2020-09-08 14:44:32 +0200
committerLars Knoll <lars.knoll@qt.io>2020-09-11 19:32:35 +0200
commit05acc167c968722bf178c17710ff34b74d9cb124 (patch)
treebb7e3ae74aed1f438cf7b7b5293aa08b1f2b783a /src/corelib/global
parent0078391c18fd93dfc52075a780ff308a18993fb6 (diff)
Remove pre-C++17 code path
Change-Id: Iaa7f677f45cee50f0b9ed236cf5bef18d5764bfa Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qglobal.h17
1 files changed, 0 insertions, 17 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index d32f1b420c..fc85bec962 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -1065,29 +1065,12 @@ QForeachContainer<typename std::decay<T>::type> qMakeForeachContainer(T &&t)
}
-#if __cplusplus >= 201703L
// Use C++17 if statement with initializer. User's code ends up in a else so
// scoping of different ifs is not broken
#define Q_FOREACH(variable, container) \
for (auto _container_ = QtPrivate::qMakeForeachContainer(container); \
_container_.i != _container_.e; ++_container_.i) \
if (variable = *_container_.i; false) {} else
-#else
-// Explanation of the control word:
-// - it's initialized to 1
-// - that means both the inner and outer loops start
-// - if there were no breaks, at the end of the inner loop, it's set to 0, which
-// causes it to exit (the inner loop is run exactly once)
-// - at the end of the outer loop, it's inverted, so it becomes 1 again, allowing
-// the outer loop to continue executing
-// - if there was a break inside the inner loop, it will exit with control still
-// set to 1; in that case, the outer loop will invert it to 0 and will exit too
-#define Q_FOREACH(variable, container) \
-for (auto _container_ = QtPrivate::qMakeForeachContainer(container); \
- _container_.control && _container_.i != _container_.e; \
- ++_container_.i, _container_.control ^= 1) \
- for (variable = *_container_.i; _container_.control; _container_.control = 0)
-#endif
#endif // QT_NO_FOREACH
#define Q_FOREVER for(;;)