summaryrefslogtreecommitdiff
path: root/src/ranges.hh
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2020-05-29 11:59:03 +1000
committerMaxime Coste <mawww@kakoune.org>2020-05-29 11:59:03 +1000
commit94f33bb63862357557ef533126a41d64b12f1c53 (patch)
tree4290036b7388a2b2a50972ec8ba0c9b25d9f9466 /src/ranges.hh
parent109abbeed40c776fdc33bd5c9344b6865122ef6d (diff)
Add a range based remove_if overload
Diffstat (limited to 'src/ranges.hh')
-rw-r--r--src/ranges.hh7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ranges.hh b/src/ranges.hh
index 2f288d0f..bd3edd9b 100644
--- a/src/ranges.hh
+++ b/src/ranges.hh
@@ -428,6 +428,13 @@ bool any_of(Range&& range, T op)
return std::any_of(begin(range), end(range), op);
}
+template<typename Range, typename T>
+auto remove_if(Range&& range, T op)
+{
+ using std::begin; using std::end;
+ return std::remove_if(begin(range), end(range), op);
+}
+
template<typename Range, typename U>
void unordered_erase(Range&& vec, U&& value)
{