summary refs log tree commit diff stats
path: root/src/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h new file mode 100644 index 0000000..150a6a5 --- /dev/null +++ b/src/util.h
@@ -0,0 +1,20 @@
1#ifndef UTIL_H_E9110D4C
2#define UTIL_H_E9110D4C
3
4template <typename Container, typename Predicate>
5void erase_if(Container& items, const Predicate& predicate)
6{
7 for (auto it = std::begin(items); it != std::end(items);)
8 {
9 if (predicate(*it))
10 {
11 it = items.erase(it);
12 }
13 else
14 {
15 ++it;
16 }
17 }
18};
19
20#endif /* end of include guard: UTIL_H_E9110D4C */