diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-05-29 16:32:28 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-05-29 16:32:28 -0400 |
commit | 72e83df4876d799cc7b7993813533041a112e250 (patch) | |
tree | 7e877b11fb6c0257b1ef9b08a7186452ccedcd90 /src/util.h | |
parent | 0dbd1d249d0138c460eaf6ca39568d8d87666cfb (diff) | |
download | ether-72e83df4876d799cc7b7993813533041a112e250.tar.gz ether-72e83df4876d799cc7b7993813533041a112e250.tar.bz2 ether-72e83df4876d799cc7b7993813533041a112e250.zip |
dust kickup spreads outward instead of being instantaneous
Diffstat (limited to 'src/util.h')
-rw-r--r-- | src/util.h | 20 |
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 | |||
4 | template <typename Container, typename Predicate> | ||
5 | void 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 */ | ||