So is there an idiomatic way to remove all items from a map for which some predicate is true?
std::remove_if "removes" items by moving them to the end of a collection and then returns an iterator to the first of the "removed" items so you can erase them or do whatever you want to do. This doesn't work for maps because maps are ordered and therefore you can't just arbitrarily move their contents around.
Is there some way of doing this with standard library algorithms? I just wrote a function but it seemed weird that I had to.
Also does anyone else find remove_if broken? I mean why not just get rid of it and have erase_if? Or at least have erase_if and remove_if?
Edited by jwezorek, 06 July 2013 - 11:21 AM.