Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2016-03-23 18:08:38 +0300
committervng <viktor.govako@gmail.com>2016-03-24 03:45:36 +0300
commitb4bdf2d98239bc82331115d13140cc7d0f59da50 (patch)
tree133f931a84259b800dd182a4ba7178857c994850 /base
parente05501259e9f5d917dd83159b6dc162852c984e6 (diff)
Added EraseIf helper.
Diffstat (limited to 'base')
-rw-r--r--base/stl_helpers.hpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/base/stl_helpers.hpp b/base/stl_helpers.hpp
index f4f3ca3b97..3375867f75 100644
--- a/base/stl_helpers.hpp
+++ b/base/stl_helpers.hpp
@@ -45,12 +45,18 @@ struct Comparer<false, T, C>
// Sorts and removes duplicate entries from |v|.
template <typename T>
-void SortUnique(std::vector<T> & v)
+void SortUnique(vector<T> & v)
{
sort(v.begin(), v.end());
v.erase(unique(v.begin(), v.end()), v.end());
}
+template <typename T, class TFn>
+void EraseIf(vector<T> & v, TFn && fn)
+{
+ v.erase(remove_if(v.begin(), v.end(), forward<TFn>(fn)), v.end());
+}
+
// Creates a comparer being able to compare two instances of class C
// (given by reference or pointer) by a field or const method of C.
// For example, to create comparer that is able to compare pairs of