21 Containers library [containers]

21.4 Associative containers [associative]

21.4.6 Class template set [set]

21.4.6.3 Erasure [set.erasure]

template <class Key, class Compare, class Allocator, class Predicate> void erase_if(set<Key, Compare, Allocator>& c, Predicate pred);
Effects: Equivalent to:
for (auto i = c.begin(), last = c.end(); i != last; ) {
  if (pred(*i)) {
    i = c.erase(i);
  } else {
    ++i;
  }
}