summary refs log tree commit diff stats
path: root/src/algorithms.h
blob: 80e3e277a57f39ba55add06c5575a793c94b30cf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
#ifndef ALGORITHMS_H_1DDC517E
#define ALGORITHMS_H_1DDC517E

template< typename ContainerT, typename PredicateT >
void erase_if( ContainerT& items, const PredicateT& predicate ) {
  for( auto it = items.begin(); it != items.end(); ) {
    if( predicate(*it) ) it = items.erase(it);
    else ++it;
  }
};

#endif /* end of include guard: ALGORITHMS_H_1DDC517E */