summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libs/utils/algorithm.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/libs/utils/algorithm.h b/src/libs/utils/algorithm.h
index e08b9ad099..b1044d26e2 100644
--- a/src/libs/utils/algorithm.h
+++ b/src/libs/utils/algorithm.h
@@ -424,9 +424,18 @@ inline void sort(Container &c, Predicate p)
template <typename Container, typename Op>
inline void reverseForeach(const Container &c, const Op &operation)
{
+#if QT_VERSION < QT_VERSION_CHECK(5, 6, 0)
+ auto rend = c.begin();
+ auto it = c.end();
+ while (it != rend) {
+ --it;
+ operation(*it);
+ }
+#else
auto rend = c.rend();
for (auto it = c.rbegin(); it != rend; ++it)
operation(*it);
+#endif
}
}