From 19eb73ff543c81c6886725a20dea0060cb0c0c26 Mon Sep 17 00:00:00 2001 From: Daniel Wilhelm Date: Fri, 2 Oct 2015 14:56:27 +0200 Subject: 7.3 --- zen/stl_tools.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'zen/stl_tools.h') 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 #include -#include +#include "type_tools.h" //enhancements for @@ -22,6 +22,9 @@ void vector_remove_if(V& vec, Predicate p); template void vector_append(V& vec, const W& vec2); +template +void removeDuplicates(V& v); + template void set_append(V& s, const W& s2); @@ -72,6 +75,14 @@ void vector_remove_if(V& vec, Predicate p) } +template inline +void removeDuplicates(V& v) +{ + std::sort(v.begin(), v.end()); + v.erase(std::unique(v.begin(), v.end()), v.end()); +} + + template inline void vector_append(V& vec, const W& vec2) { -- cgit