diff options
author | Daniel Wilhelm <daniel@wili.li> | 2015-10-02 14:56:27 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2015-10-02 14:56:27 +0200 |
commit | 19eb73ff543c81c6886725a20dea0060cb0c0c26 (patch) | |
tree | 91442c0fdb9cac90c75dfb6bb84def9df297cd77 /zen/stl_tools.h | |
parent | 7.2 (diff) | |
download | FreeFileSync-19eb73ff543c81c6886725a20dea0060cb0c0c26.tar.gz FreeFileSync-19eb73ff543c81c6886725a20dea0060cb0c0c26.tar.bz2 FreeFileSync-19eb73ff543c81c6886725a20dea0060cb0c0c26.zip |
7.3
Diffstat (limited to 'zen/stl_tools.h')
-rw-r--r-- | zen/stl_tools.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/zen/stl_tools.h b/zen/stl_tools.h index bd76e264..685f5118 100644 --- a/zen/stl_tools.h +++ b/zen/stl_tools.h @@ -9,7 +9,7 @@ #include <memory> #include <algorithm> -#include <zen/type_tools.h> +#include "type_tools.h" //enhancements for <algorithm> @@ -22,6 +22,9 @@ void vector_remove_if(V& vec, Predicate p); template <class V, class W> void vector_append(V& vec, const W& vec2); +template <class V> +void removeDuplicates(V& v); + template <class V, class W> void set_append(V& s, const W& s2); @@ -72,6 +75,14 @@ void vector_remove_if(V& vec, Predicate p) } +template <class V> inline +void removeDuplicates(V& v) +{ + std::sort(v.begin(), v.end()); + v.erase(std::unique(v.begin(), v.end()), v.end()); +} + + template <class V, class W> inline void vector_append(V& vec, const W& vec2) { |