PluginManager: Code clean up

Mostly refactor some explicit loops, and nicer reverse looping.

Change-Id: I102b86da597b37cd496762bd776af73ec407d838
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Eike Ziller
2016-06-22 16:41:55 +02:00
parent 667518ad23
commit 5fcf0c438f
6 changed files with 85 additions and 100 deletions

View File

@@ -418,4 +418,15 @@ inline void sort(Container &c, Predicate p)
std::sort(c.begin(), c.end(), p);
}
//////////////////
// reverseForeach
/////////////////
template <typename Container, typename Op>
inline void reverseForeach(const Container &c, const Op &operation)
{
auto rend = c.rend();
for (auto it = c.rbegin(); it != rend; ++it)
operation(*it);
}
}