Utils: Fix compile for Qt5.5

Change-Id: I4294fb7dd448e74236e085f7a1884ecedd5a5b90
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Christian Stenger
2016-06-27 07:15:08 +02:00
committed by Eike Ziller
parent 0ec8fdda5c
commit 891899dcd4

View File

@@ -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
}
}