diff options
Diffstat (limited to 'src/algorithms.h')
-rw-r--r-- | src/algorithms.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/algorithms.h b/src/algorithms.h new file mode 100644 index 0000000..80e3e27 --- /dev/null +++ b/src/algorithms.h | |||
@@ -0,0 +1,12 @@ | |||
1 | #ifndef ALGORITHMS_H_1DDC517E | ||
2 | #define ALGORITHMS_H_1DDC517E | ||
3 | |||
4 | template< typename ContainerT, typename PredicateT > | ||
5 | void erase_if( ContainerT& items, const PredicateT& predicate ) { | ||
6 | for( auto it = items.begin(); it != items.end(); ) { | ||
7 | if( predicate(*it) ) it = items.erase(it); | ||
8 | else ++it; | ||
9 | } | ||
10 | }; | ||
11 | |||
12 | #endif /* end of include guard: ALGORITHMS_H_1DDC517E */ | ||