From b204d3d3172cb8121d606f3d2b3817dc8b23e23a Mon Sep 17 00:00:00 2001
From: Norihiro Watanabe <norihiro.watanabe@ufz.de>
Date: Wed, 26 Oct 2016 06:57:23 +0200
Subject: [PATCH] [Base] add another makeVectorUnique() which takes a Comapre
 object

---
 BaseLib/makeVectorUnique.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/BaseLib/makeVectorUnique.h b/BaseLib/makeVectorUnique.h
index 160f1e84ae9..4fa9522d022 100644
--- a/BaseLib/makeVectorUnique.h
+++ b/BaseLib/makeVectorUnique.h
@@ -27,5 +27,15 @@ void makeVectorUnique(std::vector<T>& v)
     v.erase(it, v.end());
 }
 
+/// Make the entries of the std::vector \c v unique using the given binary
+/// function. The remaining entries will be sorted.
+template <typename T, class Compare>
+void makeVectorUnique(std::vector<T>& v, Compare comp)
+{
+    std::sort(v.begin(), v.end(), comp);
+    auto it = std::unique(v.begin(), v.end());
+    v.erase(it, v.end());
+}
+
 } // end namespace BaseLib
 #endif
-- 
GitLab