diff options
| author | Eike Ziller <eike.ziller@qt.io> | 2016-06-22 16:41:55 +0200 |
|---|---|---|
| committer | Eike Ziller <eike.ziller@qt.io> | 2016-06-24 12:30:05 +0000 |
| commit | 5fcf0c438fd5a131dad3fc47cb8974858c9f13f4 (patch) | |
| tree | 9efa5341974f82db90f844f6202ccbc90498b28f /src/libs/utils/algorithm.h | |
| parent | 667518ad23bb8e13f436e4ed735c19764ea83238 (diff) | |
| download | qt-creator-5fcf0c438fd5a131dad3fc47cb8974858c9f13f4.tar.gz | |
PluginManager: Code clean up
Mostly refactor some explicit loops, and nicer reverse looping.
Change-Id: I102b86da597b37cd496762bd776af73ec407d838
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Diffstat (limited to 'src/libs/utils/algorithm.h')
| -rw-r--r-- | src/libs/utils/algorithm.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libs/utils/algorithm.h b/src/libs/utils/algorithm.h index 0867bfc2b4..e08b9ad099 100644 --- a/src/libs/utils/algorithm.h +++ b/src/libs/utils/algorithm.h @@ -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); +} + } |
